By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,569 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

Javascript enabled ?

P: n/a
Hi,

Is it possible to check if the javascript is turn on on the browser (IE,
firefox, ...)?
Thanks,
Christian,
Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
In article <41*********************@news.skynet.be>, ml@cista.be says...
Hi,

Is it possible to check if the javascript is turn on on the browser (IE,
firefox, ...)?


Yes. Try executing some JS in your web page. If it runs, JS is
enabled. If it doesn't, it isn't.

--
Hywel http://kibo.org.uk/
I do not eat quiche.
Jul 23 '05 #2

P: n/a
"Christian Ista" <ml@cista.be> wrote in message
news:41*********************@news.skynet.be...
Hi,

Is it possible to check if the javascript is turn on on the browser (IE,
firefox, ...)?
Thanks,
Christian,


Here's one way. Watch for word-wrap.

<html>
<head>
<title>jsenabled.htm</title>
<script type="text/javascript">
function js() {
document.getElementById("JS").innerHTML = "JavaScript is enabled!"
}
</script>
</head>
<body onload="js()">
<span id="JS">JavaScript is not enabled!</span>
</body>
</html>

I doubt that it's cross-browser compatible -- we'll probably hear from
others!
Jul 23 '05 #3

P: n/a
McKirahan wrote on 28 dec 2004 in comp.lang.javascript:
"Christian Ista" <ml@cista.be> wrote in message
Is it possible to check if the javascript is turn on on the browser
(IE, firefox, ...)?

Here's one way. Watch for word-wrap.

<html>
<head>
<title>jsenabled.htm</title>
<script type="text/javascript">
function js() {
document.getElementById("JS").innerHTML = "JavaScript is enabled!"
}
</script>
</head>
<body onload="js()">
<span id="JS">JavaScript is not enabled!</span>
</body>
</html>


<html>
<head>
<title>jsNOTenabled.html</title>
<script type="text/javascript">
location.href = '/jsenabled.html'
</script>
</head>
<body>
JS NOT enabled
</body>
</html>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #4

P: n/a
McKirahan wrote:
"Christian Ista" <ml@cista.be> wrote in message
news:41*********************@news.skynet.be...
Hi,

Is it possible to check if the javascript is turn on on the browser (IE,
firefox, ...)?
Thanks,
Christian,

Here's one way. Watch for word-wrap.

<html>
<head>
<title>jsenabled.htm</title>
<script type="text/javascript">
function js() {
document.getElementById("JS").innerHTML = "JavaScript is enabled!"


= "Javascript is enabled, your browser supports getElementById and it
supports innerHTML. Doesn't mean a lot though."

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #5

P: n/a
JRS: In article <41*********************@news.skynet.be>, dated Tue, 28
Dec 2004 17:57:21, seen in news:comp.lang.javascript, Christian Ista
<ml@cista.be> posted :

Is it possible to check if the javascript is turn on on the browser (IE,
firefox, ...)?


You should first ask yourself how the information might be used; or, if
you know, explain your intent.

ISTM perfectly possible (untested) to do something like

<script type="text/VBScript"> dim JSisON : JSisON=false </script>

<script type="text/javascript"> JSisON=true </script>

<script type="text/VBScript">
document.write " JS is ON is ", JSisON </script>

but rather unusual.

Otherwise, what you ask is not entirely unlike asking what the result of
your own last round of Russian Roulette was.

One possibility is to put on the first page, presumably at the top,

<script type="text/javascript"> location.href = "XX.htm" </script>

Page XX.htm will be reached when javascript is enabled; otherwise, the
first page remains scriptlessly active.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.