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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

location.href

Status
Not open for further replies.

PGMR1998

MIS
Apr 10, 2001
29
US
i have a function that sends me to another page. problem is that i cannot get back when i hit my back button. here is my code:

function getPDF() {
url = "00A2001";
url = " + url + ".pdf";
document.write (&quot;<meta http-equiv='refresh' content='1; url=&quot; + url + &quot;'>&quot;);
location.href = url;
}
 
How are you calling the function?

You probably don't need the [tt]document.write (&quot;<meta http-equiv='refresh' content='1; url=&quot; + url + &quot;'>&quot;);[/tt] line either.
 
PGMR,
Dwarfthrower is right, you don't need the document.write line.

You should also get rid of the semicolon following opinions/ in the url line.

I tested the logic, it called a PDF and then returned to the originating page when the back button was clicked.

The semicolon must be the culprit.

Your code slightly modified:

function getPDF() {
url = &quot;00A2001&quot;;
url = &quot; + url + &quot;.pdf&quot;;
location.href = url;
}
 
PGMR,
oops! I cut and pasted and left that dang semicolon in. Dump it.
 
when i take out that statement, it no longer goes to the url. it just sits on the previous screen.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top