RE: Javascript test in ColdFusion
My pleasure RR. andy -Original Message- From: Robert Rhodes [mailto:rrhode...@gmail.com] Sent: Wednesday, April 04, 2012 7:05 PM To: cf-talk Subject: Re: Javascript test in ColdFusion Thanks to all for the suggestions on this. I went with the approach below and it worked well. Thank you Andy, -RR On Mon, Mar 26, 2012 at 11:39 PM, andy matthews wrote: > > A dead simple way of testing for JavaScript: > > >window.location.href = 'javascriptCapable.cfm'; http-equiv=refresh content="1; url=nonJavascriptCapable.cfm"> > > If a browser understands JS they get one page, if they don't they get > another. > > One thing to consider though that it's not quite as simple as > "understanding JS"...you should be checking for specific functionality > using something like Modernizr. > > http://www.modernizr.com/ > > > > andy > > > > -Original Message- > From: Robert Rhodes [mailto:rrhode...@gmail.com] > Sent: Monday, March 26, 2012 12:00 PM > To: cf-talk > Subject: Javascript test in ColdFusion > > > Hello again. > > I have a site that loads all the content in ajax. I also have a > version of the site that does not use ajax. > > I am looking for some code I can put in the application.cfm to test to > see if the visitor's browser supports javascipt or not, so I can load > the right version of the site. > > Any ideas? > > Thanks. > > --RR > > > > > ~| 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:350641 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Javascript test in ColdFusion
Umm.. Why not just put in ? On Mon, Mar 26, 2012 at 8:39 PM, andy matthews wrote: > > A dead simple way of testing for JavaScript: > > > window.location.href = 'javascriptCapable.cfm'; > > > > If a browser understands JS they get one page, if they don't they get > another. > > One thing to consider though that it's not quite as simple as "understanding > JS"...you should be checking for specific functionality using something like > Modernizr. > > http://www.modernizr.com/ > > > > andy > > > > -Original Message- > From: Robert Rhodes [mailto:rrhode...@gmail.com] > Sent: Monday, March 26, 2012 12:00 PM > To: cf-talk > Subject: Javascript test in ColdFusion > > > Hello again. > > I have a site that loads all the content in ajax. I also have a version of > the site that does not use ajax. > > I am looking for some code I can put in the application.cfm to test to see > if the visitor's browser supports javascipt or not, so I can load the right > version of the site. > > Any ideas? > > Thanks. > > --RR > > > > > ~| 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:350636 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Javascript test in ColdFusion
Thanks to all for the suggestions on this. I went with the approach below and it worked well. Thank you Andy, -RR On Mon, Mar 26, 2012 at 11:39 PM, andy matthews wrote: > > A dead simple way of testing for JavaScript: > > >window.location.href = 'javascriptCapable.cfm'; > > > > If a browser understands JS they get one page, if they don't they get > another. > > One thing to consider though that it's not quite as simple as > "understanding > JS"...you should be checking for specific functionality using something > like > Modernizr. > > http://www.modernizr.com/ > > > > andy > > > > -Original Message- > From: Robert Rhodes [mailto:rrhode...@gmail.com] > Sent: Monday, March 26, 2012 12:00 PM > To: cf-talk > Subject: Javascript test in ColdFusion > > > Hello again. > > I have a site that loads all the content in ajax. I also have a version of > the site that does not use ajax. > > I am looking for some code I can put in the application.cfm to test to see > if the visitor's browser supports javascipt or not, so I can load the right > version of the site. > > Any ideas? > > Thanks. > > --RR > > > > > ~| 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:350635 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Javascript test in ColdFusion
A dead simple way of testing for JavaScript: window.location.href = 'javascriptCapable.cfm'; If a browser understands JS they get one page, if they don't they get another. One thing to consider though that it's not quite as simple as "understanding JS"...you should be checking for specific functionality using something like Modernizr. http://www.modernizr.com/ andy -Original Message- From: Robert Rhodes [mailto:rrhode...@gmail.com] Sent: Monday, March 26, 2012 12:00 PM To: cf-talk Subject: Javascript test in ColdFusion Hello again. I have a site that loads all the content in ajax. I also have a version of the site that does not use ajax. I am looking for some code I can put in the application.cfm to test to see if the visitor's browser supports javascipt or not, so I can load the right version of the site. Any ideas? Thanks. --RR ~| 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:350555 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Javascript test in ColdFusion
if i had to do something like this, i would: 1) build a site that works without js (i.e. all links take user to a new page that shows requested data) 2) enhance the site with ajax (i.e. override default link actions and load data via ajax without redirects) there's no one-liner you can put into your Application.cfc/cfm that will tell you if your user has js enabled or not. Azadi On Tue, Mar 27, 2012 at 00:59, Robert Rhodes wrote: > > Hello again. > > I have a site that loads all the content in ajax. I also have a version of > the site that does not use ajax. > > I am looking for some code I can put in the application.cfm to test to see > if the visitor's browser supports javascipt or not, so I can load the right > version of the site. > > Any ideas? > > Thanks. > > --RR > > > ~| 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:350547 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Javascript test in ColdFusion
This is something you must do on the client (browser) and is not information available on the server. So, putting it in Application.cfc isn't at straightforward as you think. If you google "test javascript enabled" you'll get a bunch of links on some client side code to run the test. BrowserHawk also has this capability, though I think it's overkill if this is the only thing you're trying to detect. -Cameron On Mon, Mar 26, 2012 at 12:59 PM, Robert Rhodes wrote: > > Hello again. > > I have a site that loads all the content in ajax. I also have a version of > the site that does not use ajax. > > I am looking for some code I can put in the application.cfm to test to see > if the visitor's browser supports javascipt or not, so I can load the right > version of the site. > > Any ideas? > > Thanks. > > --RR > > > ~| 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:350546 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm