Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

JScript bug in IE7

Options
  • 20-11-2006 2:03pm
    #1
    Closed Accounts Posts: 8,478 ✭✭✭


    window.document.execCommand("saveAs", true, "MyWebpart.dwp");
    

    The above javascript works fine in IE 6 and displays the Save HTML Document
    dialog. But in IE 7 this doesn not work. If I remove "." [DOT] from my file
    name it work. I need the dot so that user can save the web page as whatever file extension I send through.

    Help!


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    It's a "feature" of IE7's enhanced security set.

    With the old setup, it would be theoretically possible to use the command

    window.document.execCommand("saveAs", false, "c:\\boot.ini")

    (for example), to overwrite critical system files or force an exe to download onto the target machine.

    In all reality, the only files which it should be possible to tell the browser to save are HTML and Plaintext files, so IE7 forces the files to either save in that format, or disables them.

    If you need proof that this is a feature, and not a bug, rename "MyWebpart.dwp" to "MyWebpart.txt" or "MyWebpart.html", and then try any other extensions. :)

    I came across a similar "bug" today, which turned out to a revision of zone security settings in IE7.

    I would say your best bet for future proofing is to use a scripting language which allows you to change the HTTP headers and instructs IE7 to download the file instead of displaying it in the browser.


  • Closed Accounts Posts: 8,478 ✭✭✭GoneShootin


    seamus wrote:
    I would say your best bet for future proofing is to use a scripting language which allows you to change the HTTP headers and instructs IE7 to download the file instead of displaying it in the browser.

    Which I guess would be fine as all I want to do is save it anyway, and not display it before saving. It will be a "security feature" in the app for now until I code my way around it :)

    For a seagull you know lots of crap about stuff!


Advertisement