Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   Hidden unless Javascript enabled? (http://www.programmingforums.org/showthread.php?t=9506)

Writlaus Apr 24th, 2006 4:10 PM

Hidden unless Javascript enabled?
 
Could someone tell me how to have there be a message if Javascript is disabled, but have the message not appear in the first place if Javascript is enabled?

I know I could just write the message in regular html and then clear it with javascript with <body onLoad>, but I don't want to have the message there while the page is loading. Is there maybe some PHP thing I could use, similar to @$REMOTE_ADDR to detect whether the user has Javascript enabled before the page is sent?

Agent 47 Apr 24th, 2006 4:55 PM

:

<noscript>
Put your message here...
</noscript>


DaWei Apr 24th, 2006 5:00 PM

The browser is not required to send you that information. Think of it like this: you could read the RFCs and write some code to ask for a resource from some server. This would be 'your' browser. You might or might not write it to conform to 'tradition' or 'common practice.' Always bear this in mind when you are trying to wring functionality from two separate pieces of code, one residing on some client's machine, and one residing on your server, and the two authors never heard of each other and don't give a rat's ass what the other might want, outside of compliance with the RFCs. Should you happen to luck out and find a non-standard facility on one end that does what you want, you still have no guarantees about the other end. All that said, look up get_browser and HTTP_USER_AGENT in your PHP docs. If you're looking for universal miracles, though, you might should oughtta buy a chicken and get prepared to wring its neck and offer it up.

Writlaus Apr 25th, 2006 10:52 PM

That noscript tag worked fine for me, thanks =)


All times are GMT -5. The time now is 6:50 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC