Export forcing the download of the file

(6 posts) (2 voices)

Tags:

  1. Tominator, Member

    Hi,

    When I click the export-to-XXX links, the file does get generated, but it opens up in the browser window, thereby removing all MyDBR GUI. When I click 'back' in my browser, all my report settings are lost and I have to enter them again.

    Would it be possible to force the export urls to download, regardless of whether I have the right plugins to open the file? Maybe with http headers or something? Or opening the URLs in a target='_blank' so at least I don't lose my current session?

    Cheers,
    Tom

  2. myDBR Team, Key Master

    Hi,
    The export link is a normal HTML link and you can open the link into new window, or if you want to download the content directly.

    It is not made to open in new window by default in order to let use decide how the link is handled.

    --
    myDBR Team

  3. Tominator, Member

    Hi,

    Thanks for the reply, and I know it is possible to do it that way. The tricky thing is: most of the users of my myDBR instance are not that clever about website usage in general, and want it as easy as possible.

    Is there some option of me adding javascript to every report page to fidget with jquery and give those links a target-attribute? Or some other solution?

    Cheers,
    Tom

  4. myDBR Team, Key Master

    Tom,
    if you want to make opening exports into a new window a default behavior in your report, add following command into the report:

    select 'dbr.javascript', "$('.exportmenu a').addClass('new_window');", 'onload';

    --
    myDBR Team

  5. Tominator, Member

    Hi,

    I've added the line to my report, and I see that the class has indeed been added to the link elements, but no new window is opening when I click the links. I still just open the downloaded file using the browser plugins to view it.

    Is it because I have mydbr version 3.3.0? Or is that class new_window not doing much? Is there javascript missing?

  6. myDBR Team, Key Master

    Just run the updater to get the new version.

    --
    myDBR Team


Reply

You must log in to post.