page that is javascript redirected never appears in history

RESOLVED INVALID

Status

()

--
major
RESOLVED INVALID
12 years ago
5 years ago

People

(Reporter: mjg8moz, Unassigned)

Tracking

1.8 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

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

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

steps to reproduce:
- go to www.deedni.com/start.html
- 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="http://www.deedni.com/end.php">click here to start</a></body></html>

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

<html>
<head>

<script language="JavaScript">

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		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) {
	createCookie(name,"",-1);
}

</script>

<body>

<script language="JavaScript">

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

   createCookie("beenHere", "true", 1);
   window.location = "http://www.deedni.com/redirect2.php";

}

</script>

you made it!

<script language="JavaScript">

if(readCookie("beenHere") != null) {
   eraseCookie("beenHere");
}

</script>

</body>
</html>

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

<html><body>

<script language="JavaScript">

history.go(-1);

</script>

</body></html>



Reproducible: Always

Steps to Reproduce:
1. go to www.deedni.com/start.html
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.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → INVALID
(Reporter)

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....
(Reporter)

Updated

12 years ago
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Component: History → History: Session
Product: Firefox → Core
QA Contact: history → history.session
Version: unspecified → 1.8 Branch
(Reporter)

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.
(Reporter)

Comment 4

12 years ago
has anyone done anything with this?

Updated

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 = "http://www.deedni.com/redirect2.php";
> 
> }
> 
> </script>

This is invalid/wontfix, if you are talking about |window.location = ...|. Please take a look at
http://www.w3.org/TR/2011/WD-html5-20110525/history.html#location

If you are talking about |location.assign(...)|, there's some room for discussion. See also: bug 754029
Status: UNCONFIRMED → RESOLVED
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.