Impossible that it works as you describe.

If anyone runs this code they will simple see a session variable with a
string of js text.

<cfset session.screenwidth =
"<script>document.write(>screen.width);</script>" />
<cfdump var="#session#" />

You would have to do it with ajax as suggested, or use js to set a form
variable.

On Sun, Dec 23, 2012 at 6:22 PM, The Dude <[email protected]> wrote:

>
> I am running this in a cfml page and it returns the screen resolution
> consistently.
>
> I was surprised to see js scripts in cfset would capture the desired
> values in a cfml page.
>
> Try it on your end, technically it shouldn't work but I believe the
> virtual concurrency between server and client call produce the desired
> result.
>
> >Javascript is client side and will only run in the browser, you cannot run
> >it from the server inside cfml.
> >
> >so
> ><cfset session.screenwidth = "<script>document.write(
> >screen.width);</script>">
> >will simply assign the text
>  "<script>document.write(screen.width);</script>"
> >to session.screenwidth not the value your are expecting.
> >
> >you need to run this script client side.
> ><script>document.write(screen.width);</script>
> >
> >and then send the values back to the server, you could do this with ajax
> or
> >cookies.
> >
> >
> >
> >
> >>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353621
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to