Jump to content

redirect page in iframe after calling saveas dialog


saco721

Recommended Posts

Hi!,

 

I was wondering if it is possible to reload / redirect a page in an iframe after a saveas dialog has been called. It seems like quite a simple concept but I have tried various methods to get this to work without success. All I seem to get is the page reload / redirect or the saveas dialog, never both.

 

here is the code:

 

mainpage.html

 

<html>

<body>

<iframe src="filedownload.html"

width="40%" height="80"

align="right" border = "1">

</iframe>

</body>

</html>

 

filedownload.html:

 

<html>

<head>

</head>

<body>

<a href="filedownload.php?filename=filetodownload.txt">Download this text file</a>

</body>

</html>

 

filedownload.php:

 

<?PHP

 

header("Content-type: application/octet-stream");

header("Content-Length: ".filesize($filename));

header("Content-Disposition: attachment; filename=$filename");

 

 

$fp = fopen($filename, 'rb');

fpassthru($fp);

fclose($fp);

?>

 

If it is possible, what code should I use to accomplish this is, and what file the code should go in.

 

Any help would be grately appreciated! - Thank you

To put your code in code tags, click the button that has a # on it.

 

OK, I'll pretend your frame name is "famename"

 

<a target="framename" href="filedownload.php?filename=filetodownload.txt">Download this text file</a>

 

Try that.

 

As far as JS, there's a JS board on this site.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.