Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript Enabled Detection from PERL 1

Status
Not open for further replies.

kennygadams

Programmer
Jan 2, 2005
94
0
0
US
Hi,

Is there a way to detect, from PERL, if a user has Javascript enabled or disabled?

I know about the <noscript> tag (but i need to detect it from perl)
Code:
<noscript>
JavaScript is turned off in your web browser. Turn it on to take full advantage of this site, then refresh the page.
</noscript>

Thank you.
 
There won't be any direct methods for perl to determine the state of a client's javascript settings. There are hacks though, like using javascript to alter the links on your website. If your server is accessed using the altered links, then you can assume the client has javascript enabled, otherwise assume not.

An alternate method would be to use Javascript to create a dummy cookie on the client. If you can read that cookie in perl, then the user has both javascript and cookie's ennabled.

It's always safer to just assume that you can't determine this though and code your noscript alternatives.

- Miller
 
Thanks MillerH!

The reason I wanted to detect this from PERL was so I could remove unessasary JS from the pages.

Kenny G Adams
 
Hi

Kenny said:
The reason I wanted to detect this from PERL was so I could remove unessasary JS from the pages.
Pointless effort. Just put the JavaScript code in a separate file. If JavaScript is disabled the browser will not download the external JavaScript files.


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top