/    Sign up×
Community /Pin to ProfileBookmark

location.href=url behaving like location.replace(url)

I’ve run up against a problem that looks to be specific to firefox. The site works as I intend under IE7 and Safari, but not under Firefox v 3.0.13. I’ve distilled the problem down to just a few simple pages: initpage.html contains a link to linkedpage.html, and linkedpage.html uses javascript to redirect to redirtarg.html. The test is to load initpage.html and then click the link. Under IE and Safari, all three pages are in the session history, but in Firefox only initpage.html and redirtarg.html are there. It’s as though redirection was performed with location.replace.

The test pages are [url=http://intranet.glidos.net/initpage.html]here[/url], and the contents are:

initpage.html

[code]
<html>
<head><title>Initial Page</title></head>
<body>
<a href=”linkedpage.html”>Link</a>
</body>
</html>
[/code]

linkedpage.html

[code]
<html>
<head><title>Linked Page</title></head>
<body>
<script type=”text/javascript”>
location.href=’redirtarg.html’;
</script>
</body>
</html>
[/code]

redirtarg.html

[code]
<html>
<head><title>Redirection Target</title></head>
<body>
Redirection Target
</body>
</html>
[/code]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@justinbarneskinSep 10.2009 — I suppose this has been tried, out of the question for some reason...

<html>

<head><title>Linked Page</title></head>

<body>

<script type="text/javascript">

//location.href='redirtarg.html';

document.location='redirtarg.html'

</script>

</body>

</html>
Copy linkTweet thisAlerts:
@GlidosauthorSep 10.2009 — Thanks, but yes I've tried that. I even tried document.location.assign(url). Any other thoughts?
Copy linkTweet thisAlerts:
@TinKimSep 10.2009 — Interesting problem. I think, this is feature of Firefox to prevent your browsing-history being spammed with advertising content addresses. But this is only a guess.

Greetings from Germany,

Kim

--

www.youngvisions.net | www.schneider.ws | www.deutscherfussballblog.de
Copy linkTweet thisAlerts:
@GlidosauthorSep 10.2009 — Whoop! The following seems to work in IE, Safari and Firefox:
[CODE]
<html>
<head><title>Linked Page</title></head>
<script type="text/javascript">
function jmp_to_page()
{
location.href='redirtarg.html';
}
</script>
<body onLoad="setTimeout('jmp_to_page()',0)">
</body>
</html>
[/CODE]
×

Success!

Help @Glidos spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...