sgalmeida
05-14-2004, 08:26 AM
greetings
I'm getting a very strange javascript error.
on my paga I'm using a php script to preform the download operation of my files. the script is:
<?
if($_GET['file']){
header("Content-type: application/save");
header('Content-Disposition: attachment; filename="' . basename($_GET['file']) . '"');
header('Expires: 0');
header('Pragma: no-cache');
readfile($_GET['file']);
}
?>
and I'm using this script on a page that have several rollover images that works as links (I'm using dreamweaver as develop tool)
well, when I enter the page with the rollover images, everything works fine, all rollover images works as expected. But when I click on the download link (that uses the PHP script) the save dialog opens and if I cancel or save the file, all the rollover images stop to work, and I get the Javascript error "Access is denied"!!! The errors refers to the following functions:
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array(); for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
and
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
anyonehave an idea what is happening??
Thanks
Sérgio
I'm getting a very strange javascript error.
on my paga I'm using a php script to preform the download operation of my files. the script is:
<?
if($_GET['file']){
header("Content-type: application/save");
header('Content-Disposition: attachment; filename="' . basename($_GET['file']) . '"');
header('Expires: 0');
header('Pragma: no-cache');
readfile($_GET['file']);
}
?>
and I'm using this script on a page that have several rollover images that works as links (I'm using dreamweaver as develop tool)
well, when I enter the page with the rollover images, everything works fine, all rollover images works as expected. But when I click on the download link (that uses the PHP script) the save dialog opens and if I cancel or save the file, all the rollover images stop to work, and I get the Javascript error "Access is denied"!!! The errors refers to the following functions:
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array(); for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
and
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
anyonehave an idea what is happening??
Thanks
Sérgio