redirect to brower

Topics: Developer Forum, User Forum
May 22, 2008 at 9:57 AM
from the document,i know we can redirect output to browser,but what can i do if i just want to let user open it with brower without pop up a dialog ask user to down or open with some app.

any code snippet or referal link will be appreciate.

May 23, 2008 at 1:45 AM
The pop up is forcing download... The pop up alert box is defualt in all browsers for users protection...  Open means open it from their temp files,  save allows them well to save it to a location of their choice.

I believe the only way to do this would be to overide the save location to a web accessible directory....  create the file,  save in a directory under your public_html,  then redirect the user to the url....

page 23 of the doc...



so just before you save() set the temp...  to well a publicly accessible directory...

now redirect:
$ReportUrl = "/reports/05featuredemo.xls";
header("Location: $ReportUrl");

This of course brings up a whole slew of security issues,  is the data sensitive?  if so it is now open to the world any one that happens to type in

gets the report,  unless your users are loging in via htaccess then you could include that directory in the protection....

another option would be to do the same as above,  but save the file in a directory that falls under the .htaccess protection,  the instead of redirecting using php's CURL to go to the file (loging in of course) and reading it,  then echoing the content back to the browser....

All in all the most secure and easy way is to live with the box,  the box is nothing new nor will your clients (if they have ever used the internet) will be used to seeing it.  Even the google reports when you export them to CSV or PDF you get the box.... It is a part of life online it is their to protect your users,  gives them one last chance to confirm that is really what they want to do...