Re: [SMARTY] Setting a variable if javascript is enabled?

From: Date: Wed, 12 Feb 2003 16:45:53 +0000
Subject: Re: [SMARTY] Setting a variable if javascript is enabled?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7686@lists.php.net to get a copy of this message
Check the PHP archives. this has come up before, and there is a sneeky way to do it. the user has to go between pages for that to happen, or you have to redirect them or something. Essentially, you put a snippet of JS with 'onload' event that changes a hidden variable's value. If it isn't changed, there's no javascript. 2/12/2003 5:37:02 AM, "Jason Sweat" <sweatjejm@mchsi.com> wrote: >Hi Matthias, > >Sorry for mis-reading your question. > >As far as I know, there is no $_SERVER variable that tells _if_ js is >enabled ( you could check the $_SERVER['HTTP_USER_AGENT'] to see if they are >running a browser capable of js). > >You could try something sneaky like having js do a document.write of a 1 >pixel x 1 pixel image that is a php script. This script could set a >variable in the session indicating that js is enabled (and then output the >small image), and the rest of you app could work from that. > >HTH > >Jason > >----- Original Message ----- >From: "Matthias Mohr" <MMohr@sysdesign-edv.de> >To: <smarty-general@lists.php.net> >Sent: Wednesday, February 12, 2003 7:15 AM >Subject: Re: [SMARTY] Setting a variable if javascript is enabled? > > >> Hi Jason, >> >> > http://smarty.php.net/faq.php#18 >> That was not the question. >> >> I need to set a smarty or PHP-variable if javacript is enabled >> for using javascript-codesnippets inside my HTML-elements. >> (like the usage of the javascript &{mydisp} variable inside the >> UL-tag) >> >> I've already escaped my javascript code by changing the default- >> delimiters of smarty to "<{" and "}>", so escaping javascript is >> not the problem... >> >> Anybody else any idea? >> Maybe there is a REQUEST-variable I could use, or other >> PHP-features... >> But I didn't find any useful. >> >> with regards, >> Matthias >> >> >> >> -- >> Smarty General Mailing List (http://smarty.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > >-- >Smarty General Mailing List (http://smarty.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.smarty.general (#7686) next »