SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Dec 2005
    Location
    Oklahoma
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to get Message Box before file download?

    I'm really rusty on my JavaScript and have a friend wanting me to help them out last minute.

    I'm wanting a message box to appear when a user clicks on a link that pops up a message. Once they click "OK' on the message box, a file download box pops up letting them open/save the file.

    Basically a person clicks on a link for a class. A message box pops up saying "Please print and bring the following papers to class." When they click "OK", the *.pdf file pops up ready to be downloaded.

    Can anyone point me in the right direction?

    Thanks.

  2. #2
    SitePoint Member
    Join Date
    Dec 2005
    Location
    Oklahoma
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is what I have so far. This somewhat worked for a *.pdf because the browser would open the file. I've been told they want to use a *.docx file, which doesn't work. Any advice on how I can modify this to work? I'm wanting the "Open/Save" File download box to appear after the message.


    <html><head><title>Course Content</title>
    <script type="text/javascript">
    function linkRef(yurl ){
    var linkref = yurl;
    if(confirm("Please print the following pages and bring to class.")){
    window.location.href=linkref;
    }
    }
    </script>
    </head>
    <body>
    <a href="#" onClick="linkRef('http://www.whatever.com/test.docx' )">Link to Document</a>
    </body>
    </html>


Bookmarks

Posting Permissions

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