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

redirect issue in FirFox

Status
Not open for further replies.

spicymango

Programmer
May 25, 2008
119
CA
Hi,

I hava a page A that redirect to page B. Now I want to go back to the page I came from(Page A).

Using javascript:history.go(-1)"> I can go back but not in FireFox

Link to my site

My Page A code
Code:
<script language="JavaScript">

chk()

function chk() {
	alert("Main Page");
		document.location.href='[URL unfurl="true"]http://www.natradersonline.com/testpage2.shtml';[/URL]
	
}
</script>


<html>
<head>
</head>
<body>
</body>
</html>
 
Code:
//try this
<script language="JavaScript">
function chk() {
window.location='[URL unfurl="true"]http://www.natradersonline.com/testpage2.shtml';[/URL]
}
</script>
 
I tried it. My issue is not that I am not eting redirected. That is fine both in IE and fire fox. Issue is in FireFox I can not go back to the previous page which redirected me. It by pass that page when I do javascript:history.go(-1)"> , and goes to one before that.
 
Well - it all works for me using the following code, in both IE6 and Fx2:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] dir="ltr" lang="en-US">
<head profile="[URL unfurl="true"]http://gmpg.org/xfn/11">[/URL]
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<meta http-equiv="content-language" content="en" />
	<title>Redirect Test - Page 01</title>

	<script type="text/javascript">
		function doRedirect() {
			document.location.href = 'redirect02.html';
		}
	</script>
</head>

<body>
	<h1>Page 01</h1>
	<a href="javascript:doRedirect();">Do redirect</a>
</body>
</html>

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] dir="ltr" lang="en-US">
<head profile="[URL unfurl="true"]http://gmpg.org/xfn/11">[/URL]
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<meta http-equiv="content-language" content="en" />
	<title>Redirect Test - Page 02</title>

	<script type="text/javascript">
		function doRedirect() {
			history.go(-1);
		}
	</script>
</head>

<body>
	<h1>Page 02</h1>
	<a href="javascript:doRedirect();">Do redirect</a>
</body>
</html>

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top