View Full Version : Testing that scripting is enabled in the browser
hippotech
09-26-2002, 04:48 PM
Hi,
I'm hoping someone can point me in the right direction. :)
I'd like to test if a users browser has 'scripting' enabled (either for ASP or Javascript) in order to either give them an "upgrade your borwser" message or "you need to switch on scripting in the advanced options" or redirect to a degraded page without the extra functionality.
If this is possible can someone let me know, even better still, point me to a page where something similar is in operation.
Thanks in advance
joh6nn
09-26-2002, 05:05 PM
<noscript>
Your browser does not support JavaScript, or you have JavaScript turned off.
</noscript>
hippotech
09-26-2002, 05:11 PM
Thanks Joh6nn,
That isn't sophisticated enough for what I want. That makes the assumption that the Browser cannot be enabled through the options dialogue.
I need something more of a sniffer that difinitively knows which browser and if the option is switchable.
Thanks
Roy Sinclair
09-26-2002, 10:25 PM
You can't script any checks whatsoever if scripting is turned off. The <noscript></noscript> tags are your one and only option for communicating with users who don't support or haven't enabled scripting.
hippotech
09-27-2002, 10:46 AM
Oh my god!
Just realised how thick I've been. Trying to run a script with Javascript turned off Doh!
Sorry to waste your time guys and thanks for your patience in replying to a dunce without flaming him!
I'll take my embarrassment to crawl away to my cave...
Regards
Greg
BrainJar
09-27-2002, 04:30 PM
What you can do is make an intro page that assumes the browser doesn't support scripting. Put whatever text you like on it.
But also add a script in the head section to redirect the browser:
<script language="text/javascript">
window.location.href = "myRealPage.html";
</script>
Browsers that do have scripting enabled will jump to your main page almost immediately. Those that don't will stay on the intro page.
hippotech
09-27-2002, 04:50 PM
BrainJar,
Your a first class fella, thanks. This is just the thing for the job
Regards
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.