RE: Javascript enabled
I'd suggest going with Josh's example. It's simple and unobtrusive. -Original Message- From: Richard White [mailto:[EMAIL PROTECTED] Sent: Sunday, November 11, 2007 12:08 PM To: CF-Talk Subject: Re: Javascript enabled > $.get('shop/includes/setjsenabled.cfm'); // this is the ajax call hey josh, this seems very simple, thanks :) richard ~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293110 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Javascript enabled
> $.get('shop/includes/setjsenabled.cfm'); // this is the ajax call hey josh, this seems very simple, thanks :) richard ~| ColdFusion 8 - Build next generation apps today, with easy PDF and Ajax features - download now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293089 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Javascript enabled
> -Original Message- > From: Andrew Grosset [mailto:[EMAIL PROTECTED] > Sent: Sunday, November 11, 2007 12:56 AM > To: CF-Talk > Subject: Re: Javascript enabled > > My vote goes to Bobby's solution...elegant and simple > > There is a typo in the example though > change: > document.getElementById('theJSMessage').style.display='none'; > to: > document.getElementById('noJSMessage').style.display='none'; I've an (old, but still applicable) article here that does this: http://www.depressedpress.com/Content/Development/ColdFusion/Articles/GetRes /Index.cfm Basically you set a "noJS" variable as being zero. On the page one of the images (in the examples it's a single pixel, transparent GIF) is written by JavaScript (and sets several values to be sent). The image called is actually a CF page which updates the session values and returns the GIF image. Your user can log on normally but be redirected to a "you need..." page immediately following. If Script isdisabled the check will still fail if images are also disabled. So your "you need..." page would have to reflect that information as well. There are a lot of improvements I could see to this (the article is seven years old) but as it is it'll do the job. Namely you could use an existing page graphic and also output a "noscript" section to ensure that it get's called even if script is disabled. Jim Davis ~| Create robust enterprise, web RIAs. Upgrade to ColdFusion 8 and integrate with Adobe Flex http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293088 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Javascript enabled
My vote goes to Bobby's solution...elegant and simple There is a typo in the example though change: document.getElementById('theJSMessage').style.display='none'; to: document.getElementById('noJSMessage').style.display='none'; Andrew. >You could set up your login page like... > >You need javascript >etc...>,/form> > >Then run some js that changes the display for each. > > >document.getElementById('theJSMessage').style.display='none'; >document.getElementById('theForm').style.display='block'; > > > >If the user doesn't have JS, the login page is a message that says You need >JS. If they DO have JS, the login page hides the no JS message and displays >the form but either way... application.cfc includes the login.cfm as usual. > >.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. >Bobby Hartsfield >http://acoderslife.com ~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293084 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Javascript enabled
> thanks for all your replies, i was just wondering josh.. i was interested > in what you said about the ajax call, is this > something simple to do... if so could you provide a short example of the > ajax call? Sure, I use jQuery and it looks like this - keep in mind I have already cfparam'd session.jsenabled = false, and included the jQuery source file before this. I think the other people who posted might have better solutions for your particular implementation, but this is a good technique to know about nonetheless. $(document).ready(function() { $.get('shop/includes/setjsenabled.cfm'); // this is the ajax call }); </cfoutput> Then setjsenabled.cfm is one line: onSessionEnd then logs the value of session.jsenabled into a db table when the session ends. This way we can easily see what percentage of our visitors have js enabled, because session.jsenabled will never be set to true if the user does not have JS enabled. -- Josh - Original Message - From: "Richard White" <[EMAIL PROTECTED]> To: "CF-Talk" Sent: Saturday, November 10, 2007 4:19 PM Subject: Re: Javascript enabled > Hi Casey... Wow, what a simple but very clever solution. very impressed. > thanks :) > > thanks for all your replies, i was just wondering josh.. i was interested > in what you said about the ajax call, is this something simple to do... if > so could you provide a short example of the ajax call? > > thanks again :) > > ~| Create robust enterprise, web RIAs. Upgrade to ColdFusion 8 and integrate with Adobe Flex http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293083 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Javascript enabled
Hi Casey... Wow, what a simple but very clever solution. very impressed. thanks :) thanks for all your replies, i was just wondering josh.. i was interested in what you said about the ajax call, is this something simple to do... if so could you provide a short example of the ajax call? thanks again :) ~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293082 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Javascript enabled
On Nov 10, 2007 2:32 PM, Josh Nathanson <[EMAIL PROTECTED]> wrote: > > we would appreciate some help on how you guys to do your checks when you > > have the application.cfc handling the > logging in of users. We would > like > > the application.cfc onrequeststart method to check this all the time so > > that if the > > user turns of javascript while using the software it will inform them > > straight away that they cannot continue until they > > turn it back on > One of my co-workers showed us one of his login forms, and we were like duh... Just wrap the form in a cfsavecontent tag and use javascript to display the form. You must enable javascript in order to submit use the form on this page. Enable javascript and refresh this page to continue. ~| Enterprise web applications, build robust, secure scalable apps today - Try it now ColdFusion Today ColdFusion 8 beta - Build next generation apps Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293080 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Javascript enabled
> we would appreciate some help on how you guys to do your checks when you > have the application.cfc handling the > logging in of users. We would like > the application.cfc onrequeststart method to check this all the time so > that if the > user turns of javascript while using the software it will inform them > straight away that they cannot continue until they > turn it back on The best you can do is set up an ajax call that sets a session variable like "session.jsenabled = true". Default it to false. If the ajax call works (javascript is enabled) set the session variable to true. From the second request on, the server will be "aware" via the session.jsenabled variable if the user has js enabled or not. But, this does not quite get you where you need to be because a) it only helps from the second request on, and b) it does not check if the user has turned off JS during the session. However, it may work well enough for your needs -- it's extremely rare that someone turns js on or off in the middle of a session, or ever for that matter. Generally, it's either on or off. -- Josh - Original Message - From: "Richard White" <[EMAIL PROTECTED]> To: "CF-Talk" Sent: Saturday, November 10, 2007 9:20 AM Subject: Javascript enabled > Hi, > > before we set up the application.cfc to handle the login in of users we > had an index page that was told the user that they didn't have javascript > enabled. at the top p fhte form we had code in javascript that redirected > them to the login page. therefore if javascript was enabled it would > direct them to the login, and if it wasnt it displayed the error to them > saying that they didnt have javascript enabled > > however, we have now setup the application.cfc to handle the login of the > client. it works in the same way as the coldfusion livedocs explains ... > if a user is not logged it it includes the login.cfm page. > > so now we need the application.cfc to check whether a client has > javascript enabled but we cannot figure out how to do this. as of course > the application.cfc is on the server but it needs to go to the client to > find out if javascript is enabled and then come back to the server. > > we would appreciate some help on how you guys to do your checks when you > have the application.cfc handling the logging in of users. We would like > the application.cfc onrequeststart method to check this all the time so > that if the user turns of javascript while using the software it will > inform them straight away that they cannot continue until they turn it > back on > > thanks very much for any help > > Richard > > > ~| ColdFusion is delivering applications solutions at at top companies around the world in government. Find out how and where now http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293079 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Javascript enabled
You could set up your login page like... You need javascript ,/form> Then run some js that changes the display for each. document.getElementById('theJSMessage').style.display='none'; document.getElementById('theForm').style.display='block'; If the user doesn't have JS, the login page is a message that says You need JS. If they DO have JS, the login page hides the no JS message and displays the form but either way... application.cfc includes the login.cfm as usual. ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com ~| ColdFusion 8 - Build next generation apps today, with easy PDF and Ajax features - download now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293078 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: JavaScript Enabled Stats
This idea rules - thanks! I had never thought of this, but played with a bit and could find myself using it a decent amount. >You could use JS to load an image that's really a CFM page -- new >Image().src = "" . You would embed code to add the >record (set to notEnabled) in your page, and add code to the stats.cfm file >that would toggle it to enabled. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: JavaScript Enabled Stats
You could use JS to load an image that's really a CFM page -- new Image().src = "" . You would embed code to add the record (set to notEnabled) in your page, and add code to the stats.cfm file that would toggle it to enabled. _ From: Jason Lemahieu [mailto:[EMAIL PROTECTED] Sent: Thursday, 14 October 2004 8:44 a.m. To: CF-Talk Subject: _javascript_ Enabled Stats I want to find out about how many of our users have _javascript_ enabled. I think it'll be like 99%, but would like to know if it is, in fact, something like 75%. I can make a simple database that stores 2 values (Enabled, notEnabled) to update with each session, but I'm not sure how to exactly check. The plan would be just a simple addition to a site's Application.cfm. I want to set a var on the page, JSEnabled = false; then use _javascript_ to set the var to true onLoad. (which will obviously only happen if they have JS enabled) The problem then, is how do I get this information back, as the page is not just a form. They could click on any number of links which I don't want to change. Has anyone tried taking stats like this before? Otherwise, is it available in some other way? (For example, a cgi.client_javascript??) _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: JavaScript Enabled Stats
If all you need is the JS version, there is an easier way which I'm sure you could google, but if you want more... We use a service call http://www.browserhawk.com/ to do all of our browser testing. I wrote a CFC that interfaces w/ their code. It is handy because we know on the fly what version of Flash, JS, connection speed, ... and other junk. We get back stats for all these vars: OS, OSDetail, Browser, FullVersion, MSN, AOL, Gecko, GeckoBuildDate, BrowserBuild, IPAddress, ResolveIP, Referrer, LanguageType, ConnectionSpeed, ConnectionType, ResolutionHeight, ResolutionWidth, BrowserHeight, BrowserWidth, ColorDepth, Flash, FlashSP2, FontSmoothing, Cookies, _javascript_, _javascript_Ver, JavaApplets, ActiveXControls, DHTML, IFrames, StyleSheets, FileUpload, MouseOver, ImagesEnabled, Plugin_Acrobat, Plugin_AcrobatVerEx, ImagesEnabled. Ryan Duckworth Macromedia ColdFusion Certified Professional Uhlig Communications 10983 Granada Lane Overland Park, KS 66211 (913) 754-4272 _ From: Jason Lemahieu [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 2:44 PM To: CF-Talk Subject: _javascript_ Enabled Stats I want to find out about how many of our users have _javascript_ enabled. I think it'll be like 99%, but would like to know if it is, in fact, something like 75%. I can make a simple database that stores 2 values (Enabled, notEnabled) to update with each session, but I'm not sure how to exactly check. The plan would be just a simple addition to a site's Application.cfm. I want to set a var on the page, JSEnabled = false; then use _javascript_ to set the var to true onLoad. (which will obviously only happen if they have JS enabled) The problem then, is how do I get this information back, as the page is not just a form. They could click on any number of links which I don't want to change. Has anyone tried taking stats like this before? Otherwise, is it available in some other way? (For example, a cgi.client_javascript??) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: JavaScript Enabled Stats
We use a service call http://www.browserhawk.com/ to do all of our browser testing. We get back stats for all these vars. I wrote a CFC that interfaces w/ their code. It is handy because we know on the fly what version of Flash, JS, connection speed, ... and other junk. OS OSDetail Browser FullVersion MSN AOL Gecko GeckoBuildDate BrowserBuild IPAddress ResolveIP Referrer LanguageType ConnectionSpeed ConnectionType ResolutionHeight ResolutionWidth BrowserHeight BrowserWidth ColorDepth Flash FlashSP2 FontSmoothing Cookies _javascript_ _javascript_Ver JavaApplets ActiveXControls DHTML IFrames StyleSheets FileUpload MouseOver ImagesEnabled Plugin_Acrobat Plugin_AcrobatVerEx ImagesEnabled Ryan Duckworth Macromedia ColdFusion Certified Professional Uhlig Communications 10983 Granada Lane Overland Park, KS 66211 (913) 754-4272 _ From: Jason Lemahieu [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 2:44 PM To: CF-Talk Subject: _javascript_ Enabled Stats I want to find out about how many of our users have _javascript_ enabled. I think it'll be like 99%, but would like to know if it is, in fact, something like 75%. I can make a simple database that stores 2 values (Enabled, notEnabled) to update with each session, but I'm not sure how to exactly check. The plan would be just a simple addition to a site's Application.cfm. I want to set a var on the page, JSEnabled = false; then use _javascript_ to set the var to true onLoad. (which will obviously only happen if they have JS enabled) The problem then, is how do I get this information back, as the page is not just a form. They could click on any number of links which I don't want to change. Has anyone tried taking stats like this before? Otherwise, is it available in some other way? (For example, a cgi.client_javascript??) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]