/    Sign up×
Community /Pin to ProfileBookmark

Javascript detetion

I was wonder if there is anyway for a script to be able to detect if the client visiting the page has their javascript enabled or not, because on my site, i use a huge amount of javascripts and alot of it won’t work if javascript is disable. Does anyone know a code for if javascript is enabled direct them to a page and else direct to another page? thanks alot to everyone for helpin me!!!

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Feb 22.2008 — There was a discussion about this recently. There is no way to do it. It's easy to made a sign though.
Copy linkTweet thisAlerts:
@toicontienFeb 22.2008 — [code=html]<p id="jsNote">You have JavaScript disabled. Please <a href="...">click here</a>.</p>

<script type="text/javascript">
if (document.getElementById) {
document.getElementById("jsNote").style.display = "none";
}
</script>[/code]
Copy linkTweet thisAlerts:
@LeeUFeb 22.2008 — [CODE]
<noscript>
<meta http-equiv="refresh" content="0; URL=http://www.yourDoman.com/noscript.html">
</noscript>[/CODE]
Copy linkTweet thisAlerts:
@felgallFeb 22.2008 — Lee,

<noscript> is invalid in the head of the page and <meta> is invalid in the body of the page and so that code which is the only situation where the <noscript> tag would actually continue to be useful is therefore invalid.

The code posted by toicantien is the best way to do it using code that actually validates.
Copy linkTweet thisAlerts:
@mrhooFeb 22.2008 — [B]Add [/B]scripts to actual web pages, so that if script is not enabled, the page can stand alone.
Copy linkTweet thisAlerts:
@toicontienFeb 22.2008 — Ideally, go with mrhoo's suggestion. There's really no reason a web should require JavaScript to function. I do give exception to intranets and admin sides to web sites. Anything the general public sees should not require JavaScript to function. JavaScript should only [I]add[/I] to existing functionality. Perhaps you could post the code you are using, yalun94, and we could help create a solution so your page doesn't require JavaScript?
×

Success!

Help @yalun94 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,
)...