I think this is a lost cause, but I have the following problem. I want to use sessions to store a 'flash-enabled' true or false value so I know what content to serve up. No problem so far. If the SESSION object doesn't have a 'flash' key and there is nothing in the request (query string), I want to redirect to a detection page that then sends the user on to either a flash enabled or disabled page. Still no problem. The problem is, if the user is blocking cookies, then they'll be forced through this procedure *every* time they follow a link on my site :-(. I can't use the urlencode() method as links will be embedded in content and my authors are not smart enough to do this. Is there any way I can tell server side if the user is blocking my cookies? cheers, tim
Tim Hicks wrote:
I think this is a lost cause, but I have the following problem.
I want to use sessions to store a 'flash-enabled' true or false value so I know what content to serve up. No problem so far. If the SESSION object doesn't have a 'flash' key and there is nothing in the request (query string), I want to redirect to a detection page that then sends the user on to either a flash enabled or disabled page. Still no problem.
The problem is, if the user is blocking cookies, then they'll be forced through this procedure *every* time they follow a link on my site :-(. I can't use the urlencode() method as links will be embedded in content and my authors are not smart enough to do this.
Is there any way I can tell server side if the user is blocking my cookies?
cheers,
Can you *ahem* convince your editors to only use relative links? If so, you could, use a structure like this at the top level of your site: /contentfolder - here's your real content /flash_site - with boolean property "flash", otherwise empty /noflash_site - with no property index_html - python script Use the python script to redirect to either /flash_site/contentfolder or /noflash_site/contentfolder HTH, oliver
Can you *ahem* convince your editors to only use relative links?
Danger Will Robinson recursive url alert!
Well, I'm already getting them to use relative urls (in the content) for a variety of long and complicated reasons. All the navigation links are auto generated with absolute_url so that as soon as you follow one, you get rid of any recursive urls segments that might have built up. So, Oliver, you're plan may work. I'll see if I can get things going with your suggestion. cheers, tim
Is there any way I can tell server side if the user is blocking my cookies?
Other than by their absence, nope. It would require two requests from the server in controlled order. But you can detect it from javascript rather easily which might help you. var randstuff = Math.random().toString().substring(2); document.cookie = "randstuff="+randstuff; var accepts_cookies = (document.cookie.indexOf(randstuff)!=-1); document.cookie = "randstuff=0; expires=Tue, 1-Jan-1980 02:02:02 GMT"; There is other code out there that assumes if document.cookie contains data that cookies are accepted. I learned that with Moz 1.1 this is not true. You need to perform an actual set-check test. You could (this is gettin' scary here) then use more Javascript to modify all links on a page to add whatever state data you desire. This is actually pretty easy (see document.links) unless you've got frames in which case it is only slightly challenging. But as we all know, the Javascript road is paved with pain and suffering for nothing more than pretty baubles.
participants (4)
-
Andy McKay -
Charlie Reiman -
Oliver Bleutgen -
Tim Hicks