Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer How download and save the file without forcefully open by browser

    Hello Friends,
    I want to download and save the file without forcefully open by browser. i have .js file which force the browser to display 'Save As' dialogue box.but the file which i download is blank,
    following is the .js file

    <html>
    <body>
    <script language='javascript'>
    function downloadme(x)
    {
    alert(x);
    myTempWindow = window.open(x,'','left=10000,screenX=10000');
    myTempWindow.document.execCommand('SaveAs','null',x); myTempWindow.close();
    }
    </script>

    <a href=javascript:downloadme('\kk.doc');>Download this Doc</a>
    </body>
    </html>


    Can u plz help me out

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Carmel California
    Posts
    471
    Thanks
    0
    Thanked 1 Time in 1 Post
    With javascript, that is probobly the best way you can do it. you can change mime settings on server side languages and cause it to prompt instead of opening.
    Kris Hubby
    kwhubby site

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    This solution is, IMO, the best solution. No need for scripting, thus no need to worry about browser incompatibilities.

    <a href="/kk.doc" title="Click to open, Right-click and choose 'Save Target As...' to save.">Doc</a>

    or

    <a href="/kk.doc" title="Open document">Doc</a> <span style="font:italic 10px Verdana">(Right-click and choose 'Save Target As...' to save.)</span>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •