Claude and Kevin, you are gentlemen and scholars. It worked with virtually
negligible delay in the redirect.
Its a workable solution for getting the screen vars and loading appropriate
size jpg images on that basis for mobile. Thank you for your input.
> >>It seems there's no way to avoid the 2nd step either redirect or
> form post.
>
> The problem is not with using POST or GET, the problem is using Ajax.
> Ajax is good for many things, but not for this one.
> Just as you first attempt did, the Ajax call will be performed from
> client side, AFTER the templated is executed and the page read by the
> browser.
> You cannot do it without executing two steps, but wit redirection, the
> first step to get the values from the client is invisible for the user.
>
>
> Try my code, there are two steps, but you only see one.
> You can make a POST version of the same idea if
> 1. you do not like the idea of having parameters visible in the url,
> 2. you have other parameters to pass to the template.
>
> Try this code, same idea using a form for redirection:
> <CFIF NOT isDefined("session.screenWidth")>
> <CFIF NOT isDefined("form.screenWidth")>
> <FORM NAME="redirectForm" METHOD="POST">
> <INPUT TYPE="hidden" NAME="screenWidth" VALUE="">
> <INPUT TYPE="hidden" NAME="screenHeight" VALUE="">
> <!--- Add any other values here --->
> </FORM>
> <SCRIPT>
> document.redirectForm.screenWidth.value = screen.width;
> document.redirectForm.screenHeight.value = screen.height;
> document.redirectForm.action = window.location.href;
> document.redirectForm.submit();
> </SCRIPT>
> <CFELSE>
> <CFSET session.screenWidth = form.screenWidth>
> <CFSET session.screenheight = form.screenHeight>
> </CFIF>
> </CFIF>
>
> <!--- perform the true task of the template here --->
> <CFDUMP var="#session#">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:353662
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm