page that is javascript redirected never appears in history




12 years ago
5 years ago


(Reporter: mjg8moz, Unassigned)


1.8 Branch
Windows XP

Firefox Tracking Flags

(Not tracked)





12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20061204 Firefox/
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20061204 Firefox/

when loading a page that has an immediate javascript redirect, that page never shows up in the history...

steps to reproduce:
- go to
- click the link "click here to start"

the link takes you to end.php, which is javascript redirected to redirect2.php, which executes history.go(-1)...

----- below is the code for start.html ------

<html><body><a href="">click here to start</a></body></html>

----- below is the code for end.php -----


<script language="JavaScript">

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		var expires = "; expires="+date.toGMTString();
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	return null;

function eraseCookie(name) {



<script language="JavaScript">

if(readCookie("beenHere") == null) {

   createCookie("beenHere", "true", 1);
   window.location = "";



you made it!

<script language="JavaScript">

if(readCookie("beenHere") != null) {



----- below is the code for redirect2.php -----


<script language="JavaScript">




Reproducible: Always

Steps to Reproduce:
1. go to
2. click link

Actual Results:  
goes back to start.html

Expected Results:  
going back one in the history should take you back to end.php (this is what actually happens in IE)

end.php is never placed into the browser history, which is why go(-1) is going back to start.html
Yes, that's intentional, and has been that way for years - see bug 124245. For every one site like your example, there are several thousand that want to use an instant redirect to trap people who don't know that they can use the back button's dropdown to jump around a trap.
Last Resolved: 12 years ago
Resolution: --- → INVALID

Comment 2

12 years ago
I disagree with this assessment - I do not see why any page should ever be 
omitted from the history.  This is causing an extremely valid use website to 
not work...

If we're doing this to "protect" users that "don't know they can use the 
back button drop down menu", then why the hell should we even have it there? 
I love Mozilla and FireFox and very rarely use IE, but IE has it right in 
this case, IMHO.  There's no reason to EVER exclude a page from the history.

What is the threshhold, anyway?  The previous bug says 15 seconds, but then 
it seems it was changed....


12 years ago
Resolution: INVALID → ---
Component: History → History: Session
Product: Firefox → Core
QA Contact: history → history.session
Version: unspecified → 1.8 Branch

Comment 3

12 years ago
BTW, the reason we need this to work is because we are developing a web application to help prevent click fraud...Google AdWords banned the tool because they require that when pressing the back button, the user must be taken immediately to the previous web page and nowhere else.  

So it seems we are both on the same team here - we are both trying to protect users...although I still don't understand how leaving ANY site, redirect or not out of the history can be justified.

Comment 4

12 years ago
has anyone done anything with this?


10 years ago
Component: History: Session → Document Navigation
QA Contact: history.session → docshell
> <script language="JavaScript">
> if(readCookie("beenHere") == null) {
>    createCookie("beenHere", "true", 1);
>    window.location = "";
> }
> </script>

This is invalid/wontfix, if you are talking about |window.location = ...|. Please take a look at

If you are talking about |location.assign(...)|, there's some room for discussion. See also: bug 754029
Last Resolved: 12 years ago7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.