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

Conditional HTML Pages

Status
Not open for further replies.

Crider

Programmer
Aug 4, 2003
13
US
I want to run an ASP file in the <SCRIPT> block if the browser has scripting enabled. If scripting is disabled, I want to show an HTML page indicating that. I've tried a number of different things and it just won't work. Basically, what I need is to conditionally show page 1 or page 2 depending on whether scripting is enabled. Anyhow suggestions would be appreciated.
 
Do a Javascript redirect using the OnLoad event. If scripting is enabled it will fire and you can send them to the page that you want them to see. Also create a META REFRESH that redirects to the html page that has the &quot;You don't have scripting turned on&quot; notice. Set the refresh interval at 1 second (you'll probably have to play with this). If the javascript fires they go to one place if not, the META REFRESH sends them to another.
 
How about <noscript></noscript> HTML tags?

You can create an alternate text with a link to the alternate pages.. there is, as far as I know, no way to automatically redirect using a scripting language, because, well.. uh, if the noscript comes up they have scripting turned off. There may be a way to do it with ASP, that would be something to ask in the ASP forum. I don't know if the HTML refresh tag would work there or not, I suspect not, butit is worth a try.

When in doubt, deny all terms and defnitions.
 
You can redirect with something like this:
<html><head>
<script language=&quot;JavaScript&quot;>
function GoAway(){
window.location = &quot;}
</script>
</head>
<body OnLoad=&quot;GoAway();&quot;>
</body>
</html>

If it doesn't fire then the META would take care of it:
<meta http-equiv=&quot;Refresh&quot; content=&quot;1;url=http://www.microsoft.com&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top