By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,932 Members | 1,511 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,932 IT Pros & Developers. It's quick & easy.

Anomalous behavior in location.replace with IE

P: n/a
I've been working with a page that should act as a 'jump page' before
loading a PDF and when I use the location.replace function to replace
the jump page with the resulting PDF, both the jump page and the pdf
show up into the browser history (in IE only) leading to the dreaded
back-button loop.

My first bit of javascript (to load the jump page) is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<p><a href="testjump.html"> Next PDF</a></p>
</body>
</html>

The jump page is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<script type="text/javascript" language="JavaScript" >
//<!--
window.location.replace("http://www.adobe.com/products/postscript/pdfs/wp_oce.pdf");
//-->
</script>
</body>
</html>

Thanks in advance

DTS

--
David T. Smith
PGP Fingerprint: 7B01 0086 BC4E C092 5348 B9AE E79A 07F2 9E59 29C2
ph: 1 203 364 1796
fax: 1 203 364 1795
cell: 1 203 770 1685
E-mail David dot Smith at acm dot org
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
David T. Smith wrote:
I've been working with a page that should act as a 'jump page' before
loading a PDF and when I use the location.replace function to replace
the jump page with the resulting PDF, both the jump page and the pdf
show up into the browser history (in IE only) leading to the dreaded
back-button loop.
That shows again that client-side actions are not suited for redirection.
Use server-side redirection instead which does not break the Back button,
as the W3C recommends:

http://www.w3.org/QA/Tips/reback
My first bit of javascript (to load the jump page) is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<p><a href="testjump.html"> Next PDF</a></p>
</body>
</html>
There is no JavaScript at all contained in the above source.
The jump page is:
[...]
window.location.replace("http://www.adobe.com/products/postscript/pdfs/wp_oce.pdf");
//-->
[...]


That is in fact JavaScript code, depending on host objects of the UA's
DOM. But have you ever thought of users that UA does not provide this
object? (Obviously not, since you are not testing them before accessing
them.) And, on the other hand, have your ever thought of users having
no support for client-side JavaScript or have it disabled/restricted?

Again, what you are looking for is a server-side solution.
PointedEars
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.