Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change address bar content with the real path

Status
Not open for further replies.

stefanica

Programmer
Aug 11, 2003
4
RO
Hi,

I work on an application with struts. In some actions I have to do a forward action to a pdf file. The problem is that in the address bat remains the path:
"server/someaction.do"
and when I try to save the just opened pfd file I get in save dialog the name
"someaction"

Can I change the path in the address bar to reflect the real path to the pdf file and the save dialog to show the file name by default?


Thanks
Stefan
 
You will have to do a client side redirect. In stead of sending the PDF, send a page back to the client that has a redirect in the HTML header or JavaScript redirect.

Here is a header redirect with the meta tag:
<META HTTP-EQUIV=&quot;REFRESH&quot; CONTENT=&quot;3; URL=http://www.domain.com/my.pdf&quot;>

Here is a JavaScript redirect:
<script language=&quot;JavaScript&quot;>
document.location = &quot;</script>

The reason for having to do this is the browser keeps the URL it requested. It trusts that what comes back is just that; what it requested. The only way you can get it to change is to tell the browser to navigate to another page. This is because browsers are unaware of dynamic servers. They only display what comes back.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top