Connecting Tech Pros Worldwide Help | Site Map

Issue with using iFrame for download in IE6

Familiar Sight
 
Join Date: Sep 2007
Posts: 221
#1: Sep 5 '08
I'm having an issue in IE6 (not an issue in IE7 or Firefox) where the file save dialog window isn't appearing. I'm using a hidden iframe to prompt for a download when a user clicks a link. Any help would be appreciated.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function download_req_doc(req_doc){
  3.     var answer = confirm("Would you like to download the required documents?")
  4.     if(answer){
  5.         valid_req_doc = document.getElementById(req_doc).value
  6.         oIfrm=document.getElementById('myIFrm')
  7.         oIfrm.src=valid_req_doc
  8.         alert("To complete the evaluation process please submit the completed document to Human Resources.")
  9.         alert("REMEMBER: YOU MUST SAVE THIS FILE TO YOUR COMPUTER!")
  10.     }
  11. }
  12. </script>
  13.  
  14. ...
  15.  
  16.             <cfif session.access eq 'manager' or session.access eq 'admin'>
  17.                 <li><a href="##" onclick="download_req_doc('valid_req_path');">Download Required Documents</a></li>
  18.             </cfif>
  19.  
  20. ...
  21.  
  22. <iframe id="myIFrm" src="" style="display:none"></iframe>
  23.  
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Sep 5 '08

re: Issue with using iFrame for download in IE6


I don't know if this will solve the problem, but try giving it a name and access using window.frame["frameName"].
Familiar Sight
 
Join Date: Sep 2007
Posts: 221
#3: Sep 5 '08

re: Issue with using iFrame for download in IE6


Quote:

Originally Posted by acoder

I don't know if this will solve the problem, but try giving it a name and access using window.frame["frameName"].

I tried to name my iframe to myIFrm and changed my javascript to this:

window.frame["myIFrm"].src=valid_req_doc

but that gave me a javascript error
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Sep 5 '08

re: Issue with using iFrame for download in IE6


Sorry, that should've been window.frames[].
Familiar Sight
 
Join Date: Sep 2007
Posts: 221
#5: Sep 5 '08

re: Issue with using iFrame for download in IE6


Quote:

Originally Posted by acoder

Sorry, that should've been window.frames[].

O yeah, I should have known that. I tried it again, no error but the dialog window won't appear. Stupid IE 6, errrr
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#6: Sep 5 '08

re: Issue with using iFrame for download in IE6


OK, instead of hiding it, try making it 0 size:
Expand|Select|Wrap|Line Numbers
  1. <iframe ... style="width:0px; height:0px; border: 0px">
Familiar Sight
 
Join Date: Sep 2007
Posts: 221
#7: Sep 11 '08

re: Issue with using iFrame for download in IE6


Quote:

Originally Posted by acoder

OK, instead of hiding it, try making it 0 size:

Expand|Select|Wrap|Line Numbers
  1. <iframe ... style="width:0px; height:0px; border: 0px">

Hey acoder, sorry it took me a while to respond, I was on vacation. I tried setting the height/width but it didn't work either, hmmmm.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#8: Sep 12 '08

re: Issue with using iFrame for download in IE6


With window.frames[] syntax, use location.href. See this link.
Familiar Sight
 
Join Date: Sep 2007
Posts: 221
#9: Sep 15 '08

re: Issue with using iFrame for download in IE6


Quote:

Originally Posted by acoder

With window.frames[] syntax, use location.href. See this link.

Tried a few of those methods from that page, but still nothing. I'll just tell them to download off the network for those users using IE 6.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#10: Sep 15 '08

re: Issue with using iFrame for download in IE6


...or encourage them to upgrade. Sorry I couldn't help further.
Familiar Sight
 
Join Date: Sep 2007
Posts: 221
#11: Sep 16 '08

re: Issue with using iFrame for download in IE6


Quote:

Originally Posted by acoder

...or encourage them to upgrade. Sorry I couldn't help further.

You are a huge help acoder, I appreciate your help very much!!
Reply


Similar JavaScript / Ajax / DHTML bytes