/    Sign up×
Community /Pin to ProfileBookmark

Turning JavaScript off

Does anyone know if there is anyway to detect whether someone has turned Javascript in their browser off?

?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@WebnerdMar 13.2006 — Create a Javascript that sets a cookie. On the next page of your site, use server-side code to check if that cookie exists. If not, Javascript is disabled. Or just accommodate for it using <noscript> tags. Or, pass your pages through this page using:

http://yoursite.com/js.html?index.html

Where this file is js.html. And the file after the ? is the file you want to load.


<i>
</i>
&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;
var srch=window.location.search;

var page=srch.substring(1);

window.location.replace(unescape(page));
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
You don't have javascript turned on
&lt;/body&gt;
&lt;/html&gt;


If the user is still on that page, display a message.
Copy linkTweet thisAlerts:
@phpnoviceMar 13.2006 — Does anyone know if there is anyway to detect whether someone has turned Javascript in their browser off?[/QUOTE]
That is what [b]noscript[/b] tags are for. In fact, you can even automatically redirect the visitor to a different page if they have scripting turned off. Just place the META tag for redirecting between [b]noscript[/b] tags. I've done this. Works just fine.
Copy linkTweet thisAlerts:
@KorMar 13.2006 — Korekt. <noscript> is the simple HTML solution.
×

Success!

Help @RabBell spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...