Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
23
rated 0 times [  29] [ 6]  / answers: 1 / hits: 5956  / 11 Years ago, sun, january 12, 2014, 12:00:00

NoScript seems to be blocking javascript from loading on my site and blocks the login overlays which is very important for the site.



Is there any way I can detect NoScript extension and alert the users?



Edited to add: Looks like a lot of you didn't get me, or maybe I wasn't clear. I'm not talking about the <noscript> tag, but the NoScript Firefox extension, how would I detect if a user has it installed and/or enabled.


More From » firefox

 Answers
3

The method I have used is as follows.



<head>
<style>
.noscript-error {
background-image: url(noscript.php)
}
</style>
<style>
@import url(chrome://noscript/skin/browser.css);
</style>
</head>
<body>
<div class=noscript-error>If noscript is NOT installed (and enabled) then Firefox will make a request for noscript.php.
</div>
</body>


It's pretty self-explanatory.
This can confirm if NoScript is not in use.
You'll just need to do whatever you choose in noscript.php to set something in the session that says NoScript is disabled.



NOTE: In other browsers noscript.php will always be called, this isn't an issue becaue even if another browser is used and calls noscript.php, it won't be using NoScript as it is for Firefox only.
You can do your own magic to avoid this call if you want, but worst edge-case where a user-agent is being spoofed you'll still have an accurate indicator of whether or not NoScript is being used.
More info here



Also if you just want to know server-side whether or not JavaScript is enabled you can use



<noscript>
<img src=noJS.php alt=JavaScript is disabled />
</noscript>


In noJS.php you can write a PHP script to render a single transparent pixel (PNG or GIF) and within that script set a session variable, or store the information.


[#48778] Friday, January 10, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaredsages

Total Points: 273
Total Questions: 97
Total Answers: 105

Location: French Southern and Antarctic Lands
Member since Fri, Jan 6, 2023
1 Year ago
jaredsages questions
;