Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q921 When using a simple redirect script for javascript enabled browsers, how can I stop the browser redirecting when the user presses the back button to back out of my site?

irt.org | Knowledge Base | JavaScript | Redirect | Q921 [ previous next ]

Q921 When using a simple redirect script for javascript enabled browsers, how can I stop the browser redirecting when the user presses the back button to back out of my site?

Don't create the looping feature in the first place. Instead of doing:

<script language="JavaScript"><!--
location.href = 'nextpage.htm';
//--></script>
<noscript>
Your browser does not support JavaScript, or JavaScript is disabled.
</noscript>

Use:

<script language="JavaScript"><!--
if (document.images)
    location.replace('http://www.somewhere.com/nextpage.htm');
else
    location.href = 'nextpage.htm';
//--></script>
<noscript>
Your browser does not support JavaScript, or JavaScript is disabled.
</noscript>

Feedback on 'Q921 When using a simple redirect script for javascript enabled browsers, how can I stop the browser redirecting when the user presses the back button to back out of my site?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.