[jQuery] Re: Best way to determine if a user has Javascript enabled?
Hi. Another way to think of it is: 1. Develop a site that works without JS 2. Work out ways to enhance each page using JS 3. step 2 may result in JS users not seeing whole classes of pages, but you have a fall back at any point. This discipline may result in a better application design and may result in a faster site and may give better options for performance enhancement. Or not. It's almost certain to be more accessible and to provide a better no-js experience. Nathan -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Tuesday, April 24, 2007 8:18 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? As much as I dislike the idea of having to develop two different sites or, sometimes, just different pages, it seems like that is the only way to accommodate both JS and non-JS users. I know jQuery can be used unobtrusively, but in some cases that just doesn't seem to be a workable approach. For instance, one use I plan for jQuery is with calendars I develop. These are calendars which have one row with columns for date, time, event, and location. Usually, I put a details link on the row for the page to refresh and reveal the details beneath the main row. That works well, but would be much better with a slide and show jQuery effect. However, if JS isn't working, the details for every row in the calendar will be showing and that's a no go. Perhaps there is a way to cause the calendar to default back to its original functionality with a page refresh. Or the alternative is to develop two pages and send the user with JS to the JS page and the non-JS user to the non-JS page. Thoughts? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nathan Young -X (natyoung - Artizen at Cisco) Sent: Tuesday, April 24, 2007 3:48 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Hi. There is another surefire solution to getting a site that works with JS and non-js usage, and that is to bifurcate the experience quite early on and send the two sets of users down very different paths. In that case, JS users see one set of pages and non-js users see another. ---Nathan -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] idea pages shouoglegroups.com] On Behalf Of Rey Bango Sent: Friday, April 20, 2007 7:35 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Hi Rick, Let me summarize what everyone is saying before this turns into a long thread. Basically, there's no easy and surefire way of determining if JS is enabled on the browser. You need to code your forms and pages in the traditional way that you would any non-JS application. Once you have those pages working correctly with proper server-side validation and handling, then you can look at progressive enhancement to extend the functionality of your pages by leveraging JS, DOM-manipulation and Ajax. I realize that you're trying to find a way of doing this from a server-side perspective but you're going to end up building a hodge-podge solution that will not be effective. You have some really sharp people giving you the right advice and since I want you to be successful, I highly recommend that you follow their suggestions. This is the *only* surefire way of ensuring that browsers that have JS disabled will work properly on your site. Otherwise, its a shot in the dark. Rey... Rick Faircloth wrote: That's what's motivating the question. I'm trying to take Progressive Enhancement, as I see it, one step further by integrating the enhancement into the server-side process, where possible and applicable. This part concerns return validation result messages back to the form page, or rather back to the page itself, since I'm currently posting the form back to the page its own. If JS is disabled, then I would simply have to refresh the page. If JS is enabled, then I could use taconite to place messages on the page without refresh...if I'm understanding everything correctly. Rick
[jQuery] Re: Best way to determine if a user has Javascript enabled?
-Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] However, if JS isn't working, the details for every row in the calendar will be showing and that's a no go. Perhaps there is a way to cause the calendar to default back to its original functionality with a page refresh. Or the alternative is to develop two pages and send the user with JS to the JS page and the non-JS user to the non-JS page. Rick - what would your non-JS page look like?? Where would your details appear? Anytime you get into developing two pages - you should probably re-think your approach. Jim
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Hi, Jim... What I've typically done with non-JS calendars is put a details link at the end of the summary row with ?Details=YesEventID=3 at the end of the link refreshes the page, but this time the details area for the specified event is showing. Then the user just clicks Hide Details with ?Details=No on the end of the URL back to the same page and the details are gone. I use ColdFusion CFIF statements to determine whether or not to display the details. Usually the calendars are not that full of info such that it would pose a burden on the server to send all summary and detail info at once, but if there were sufficient data, I'd set up some kind of paging to limit the amount of data to return. It just seems like it might be easier to work with two different pages, non-JS and JS, rather than intermingle so much if and cfif code, although I could be wrong because I haven't done this before. I'm just starting to work with JS and jQuery... Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Wednesday, April 25, 2007 9:25 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] However, if JS isn't working, the details for every row in the calendar will be showing and that's a no go. Perhaps there is a way to cause the calendar to default back to its original functionality with a page refresh. Or the alternative is to develop two pages and send the user with JS to the JS page and the non-JS user to the non-JS page. Rick - what would your non-JS page look like?? Where would your details appear? Anytime you get into developing two pages - you should probably re-think your approach. Jim
[jQuery] Re: Best way to determine if a user has Javascript enabled?
-Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Wait, I see what you're saying... the same link would serve both JS and non-JS users. How would a link that would work for both situations be coded? Seems like you could have two different links: div id=js-onhttp://mylink/ajax.cfm/div div id=js-offhttp://mylink/query.cfm/div Then you'd set js-on to 'display: none;' by default and then turn it on with jQuery (and turn off 'js-off'). Jim
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick Faircloth wrote: I think I may try the AJAX solution, partly because I just want to get more experience with AJAX and mostly because it seems to be the best solution. It's not that much harder client-side than the others. But there really is more work to do on the server... Wait, I see what you're saying... the same link would serve both JS and non-JS users. How would a link that would work for both situations be coded? How to code the server side is way outside the domain of this list. On the client side, perhaps it could be done as simply as this (untested): a class=details href=eventDetails/?id=27details/a $(document).ready(function() { $(a.details).click(function() { $(this).parents(tr).eq(0) .after(tr/tr) .next(tr).load(this.href + ajax=true); return false; }); }); This is bare-bones, of course. You would probably want an animation on the display. Once the ajax has been loaded, you would probably want to change the click to a show-hide effect on the newly loaded details row. And you would probably want to guard against re-ajaxing the same details on subsequent clicks. But I think that's the basic idea. On the server side, your eventDetails code would need to check if the ajax parameter was set to true. If so, just return the contents of that row; if not, return a whole page. Does that help? -- Scott
[jQuery] Re: Best way to determine if a user has Javascript enabled?
I'll give that a try... thanks, James. Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Wednesday, April 25, 2007 2:14 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Wait, I see what you're saying... the same link would serve both JS and non-JS users. How would a link that would work for both situations be coded? Seems like you could have two different links: div id=js-onhttp://mylink/ajax.cfm/div div id=js-offhttp://mylink/query.cfm/div Then you'd set js-on to 'display: none;' by default and then turn it on with jQuery (and turn off 'js-off'). Jim
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Hi. There is another surefire solution to getting a site that works with JS and non-js usage, and that is to bifurcate the experience quite early on and send the two sets of users down very different paths. In that case, JS users see one set of pages and non-js users see another. ---Nathan -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] idea pages shouoglegroups.com] On Behalf Of Rey Bango Sent: Friday, April 20, 2007 7:35 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Hi Rick, Let me summarize what everyone is saying before this turns into a long thread. Basically, there's no easy and surefire way of determining if JS is enabled on the browser. You need to code your forms and pages in the traditional way that you would any non-JS application. Once you have those pages working correctly with proper server-side validation and handling, then you can look at progressive enhancement to extend the functionality of your pages by leveraging JS, DOM-manipulation and Ajax. I realize that you're trying to find a way of doing this from a server-side perspective but you're going to end up building a hodge-podge solution that will not be effective. You have some really sharp people giving you the right advice and since I want you to be successful, I highly recommend that you follow their suggestions. This is the *only* surefire way of ensuring that browsers that have JS disabled will work properly on your site. Otherwise, its a shot in the dark. Rey... Rick Faircloth wrote: That's what's motivating the question. I'm trying to take Progressive Enhancement, as I see it, one step further by integrating the enhancement into the server-side process, where possible and applicable. This part concerns return validation result messages back to the form page, or rather back to the page itself, since I'm currently posting the form back to the page its own. If JS is disabled, then I would simply have to refresh the page. If JS is enabled, then I could use taconite to place messages on the page without refresh...if I'm understanding everything correctly. Rick
[jQuery] Re: Best way to determine if a user has Javascript enabled?
As much as I dislike the idea of having to develop two different sites or, sometimes, just different pages, it seems like that is the only way to accommodate both JS and non-JS users. I know jQuery can be used unobtrusively, but in some cases that just doesn't seem to be a workable approach. For instance, one use I plan for jQuery is with calendars I develop. These are calendars which have one row with columns for date, time, event, and location. Usually, I put a details link on the row for the page to refresh and reveal the details beneath the main row. That works well, but would be much better with a slide and show jQuery effect. However, if JS isn't working, the details for every row in the calendar will be showing and that's a no go. Perhaps there is a way to cause the calendar to default back to its original functionality with a page refresh. Or the alternative is to develop two pages and send the user with JS to the JS page and the non-JS user to the non-JS page. Thoughts? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nathan Young -X (natyoung - Artizen at Cisco) Sent: Tuesday, April 24, 2007 3:48 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Hi. There is another surefire solution to getting a site that works with JS and non-js usage, and that is to bifurcate the experience quite early on and send the two sets of users down very different paths. In that case, JS users see one set of pages and non-js users see another. ---Nathan -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] idea pages shouoglegroups.com] On Behalf Of Rey Bango Sent: Friday, April 20, 2007 7:35 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Hi Rick, Let me summarize what everyone is saying before this turns into a long thread. Basically, there's no easy and surefire way of determining if JS is enabled on the browser. You need to code your forms and pages in the traditional way that you would any non-JS application. Once you have those pages working correctly with proper server-side validation and handling, then you can look at progressive enhancement to extend the functionality of your pages by leveraging JS, DOM-manipulation and Ajax. I realize that you're trying to find a way of doing this from a server-side perspective but you're going to end up building a hodge-podge solution that will not be effective. You have some really sharp people giving you the right advice and since I want you to be successful, I highly recommend that you follow their suggestions. This is the *only* surefire way of ensuring that browsers that have JS disabled will work properly on your site. Otherwise, its a shot in the dark. Rey... Rick Faircloth wrote: That's what's motivating the question. I'm trying to take Progressive Enhancement, as I see it, one step further by integrating the enhancement into the server-side process, where possible and applicable. This part concerns return validation result messages back to the form page, or rather back to the page itself, since I'm currently posting the form back to the page its own. If JS is disabled, then I would simply have to refresh the page. If JS is enabled, then I could use taconite to place messages on the page without refresh...if I'm understanding everything correctly. Rick
[jQuery] Re: Best way to determine if a user has Javascript enabled?
how about this: WHEN THE USER FIRST LOGS IN: cfset Session.isJSEnabled = 'no' // assume false for now JAVASCRIPT ON PAGE: --- var myUrl = 'http://myhost.com/someCFMfile.cfm'; // some URL pointing to the page as defined below var ajaxSettings = { type: 'GET', url: myUrl , dataType: html, data: {isJSenabled: 'yes'} }; jQuery(function () { jQuery.ajax(ajaxSettings); }); FILE ON SERVER (Cold Fusion example): --- cfset Session.isJSEnabled = URL.isJSEnabled // now it is YES and you can use that later in generating pages Basically, you fire off a message to the server saying that yes JS is enabled. Update the session, and use that from then on in your code.
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Thanks for the tip, Ariel.. I'll give that try! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ariel Jakobovits Sent: Sunday, April 22, 2007 8:18 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? how about this: WHEN THE USER FIRST LOGS IN: cfset Session.isJSEnabled = 'no' // assume false for now JAVASCRIPT ON PAGE: --- var myUrl = 'http://myhost.com/someCFMfile.cfm'; // some URL pointing to the page as defined below var ajaxSettings = { type: 'GET', url: myUrl , dataType: html, data: {isJSenabled: 'yes'} }; jQuery(function () { jQuery.ajax(ajaxSettings); }); FILE ON SERVER (Cold Fusion example): --- cfset Session.isJSEnabled = URL.isJSEnabled // now it is YES and you can use that later in generating pages Basically, you fire off a message to the server saying that yes JS is enabled. Update the session, and use that from then on in your code.
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Basically, you fire off a message to the server saying that yes JS is enabled. Update the session, and use that from then on in your code. I am thinking of forking my application in one area where I want to handle things very differently depending on if someone has javascript enabled, and this is the method I think would work best. The only possible downside would be if someone disables javascript in the middle of their session; however I think the likelihood of that is pretty miniscule. In this unlikely case, you could use a noscript tag to at least notify the user that their Javascript had been unexpectedly disabled, and how to rectify it. -- Josh
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Josh, I am thinking of forking my application in one area where I want to handle things very differently depending on if someone has javascript enabled, and this is the method I think would work best. The only possible downside would be if someone disables javascript in the middle of their session; however I think the likelihood of that is pretty miniscule. In this unlikely case, you could use a noscript tag to at least notify the user that their Javascript had been unexpectedly disabled, and how to rectify it. Don't forget that any bugs that crop up in your JS can cause your JS not to run--so while JS is enabled, JS errors could prevent code execution the way you expect. The likely hood of this happening is increased when your JS is created dynamically. This is why, I like unobtrusive JS--because if the code doesn't run for any reason, it's ok--you're still going to correct the behavior on the server. -Dan PS - Obviously there are times when you're trying to implement RIA and the reliance on JS is nearly absolute to accomplish the task you want to do. I'm just pointing out that even doing JS detection can be misleading on whether or not the JS executed.
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Dan G. Switzer, II schrieb: meta http-equiv=refresh content=2;url=page.htm?js=false script type=text/javascript self.location = page.htm?js=true; /script In this example if JS is enabled, the JS code would be executed redirecting the user to page w/a URL parameter indicating that JS was enabled. If the JS code doesn't execute, then the meta refresh would take over. However, I can't emphasis this enough, testing for JS is really unnecessary for all the work you've been talking about. You keep saying you want to make your code easier to manage and develop and detecting for JS in this case is just adding more complexity. It's much easier to just write the JS and if it doesn't execute then let the server-side code re-enforce the behavior. The last time I wrote any kind of detection script, was for a project that required Flash. It's been 9 years since I've written a script to detect for JS--and that was because I didn't know better. I second Dan. And the example above is one of the most annoying things you can do to a user: breaking the back button. -- Klaus
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Klaus Hartl schrieb: Dan G. Switzer, II schrieb: meta http-equiv=refresh content=2;url=page.htm?js=false script type=text/javascript self.location = page.htm?js=true; /script In this example if JS is enabled, the JS code would be executed redirecting the user to page w/a URL parameter indicating that JS was enabled. If the JS code doesn't execute, then the meta refresh would take over. However, I can't emphasis this enough, testing for JS is really unnecessary for all the work you've been talking about. You keep saying you want to make your code easier to manage and develop and detecting for JS in this case is just adding more complexity. It's much easier to just write the JS and if it doesn't execute then let the server-side code re-enforce the behavior. The last time I wrote any kind of detection script, was for a project that required Flash. It's been 9 years since I've written a script to detect for JS--and that was because I didn't know better. I second Dan. And the example above is one of the most annoying things you can do to a user: breaking the back button. PS: And even that method isn't fool-proof. You can always simply deactivate JS with two clicks when you're already on the page in question...
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Andy Matthews schrieb: Simple way to do it might be to use javascript itself to do a forward or something like that. I've seen people set up a meta refresh of 5 seconds in the header, then use javascript to do a location.href as soon as the page loads. If they have js, they get redirected immediately to page A, if they don't, then after 5 seconds, they get redirected to page B. You can still easily deactivate JS once you landed on page A... -- Klaus
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Detecting if JavaScript is enabled is actually fairly straightforward. No need to make it so complicated. Well I think this thread is about how to detect if JS is enabled on the Server-side ; ). Your method of course is the way to go if all one needs is to display a msg to the user. -- Felix -- http://www.thinkingphp.org http://www.fg-webdesign.de Giant Jam Sandwich wrote: Detecting if JavaScript is enabled is actually fairly straightforward. No need to make it so complicated. $(function(){ $(#is_disabled).css(display,none); }); ... div id=is_disabledYou have JavaScript disabled./div
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Detecting if JavaScript is enabled is actually fairly straightforward. No need to make it so complicated. Well I think this thread is about how to detect if JS is enabled on the Server-side ; ). Your method of course is the way to go if all one needs is to display a msg to the user. It's also important to remember that there typically is no real reason you even need to detect JavaScript. jQuery does an excellent job helping you write unobtrusive JS, which allows you to add JS functionality, without requiring that the user has JS for the site to still function. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Hi, Dan... The only reason I'm interested in being able to determine whether or not JS is enabled is that I'm trying to use JS to place error messages back on a page via JS (Ajax) after server-side validation. What I'm trying to determine now that I've been working on this approach (unsuccessfully so far) is if the messages can be returned to a form page via Ajax if the form wasn't submitted that way in the first place. I just want server-side validation results displayed without a page refresh... Possible? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Saturday, April 21, 2007 8:53 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Detecting if JavaScript is enabled is actually fairly straightforward. No need to make it so complicated. Well I think this thread is about how to detect if JS is enabled on the Server-side ; ). Your method of course is the way to go if all one needs is to display a msg to the user. It's also important to remember that there typically is no real reason you even need to detect JavaScript. jQuery does an excellent job helping you write unobtrusive JS, which allows you to add JS functionality, without requiring that the user has JS for the site to still function. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Actually, I'm not trying to do just client-side validation... I've already got that working by itself. And I've got server-side working...been doing that for years. Now, I'm trying to combine the two and run the client-side validation, then run the server-side validation and if there are any server-side errors thrown, pass the messages back to the form page via JS (Ajax)... Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Saturday, April 21, 2007 9:30 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Brian, I would agree to some extent that it is not necessary to detect if JavaScript is disabled. However, there are an abundance of (I do hate saying this word) Web 2.0 sites in which it is impossible to use all the features unless JavaScript is fully functioning. Sometimes it is nice just to give the user a little message that lets them know they might be missing something good ;) I know for a fact what Rick's trying to do, it's totally unnecessary to detect for JS. He's trying to do some very basic client-side validation. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Hi, all... the saga continues... I'm so close, yet so far. I think the problem is doc-type declarations. No matter what I do, it creates one problem or another. Now, as it is, the server-side works fine, but the client-side is disabled. Would someone please look at the attached code and tell me what the problem is? Slowly losing my mind... Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Giant Jam Sandwich Sent: Saturday, April 21, 2007 9:01 AM To: jQuery (English) Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Hi Felix, Rick's original question didn't specify server side... I only skimmed the messages thereafter, so that might have come out later in the thread... me being lazy on a Saturday :) @Dan I would agree to some extent that it is not necessary to detect if JavaScript is disabled. However, there are an abundance of (I do hate saying this word) Web 2.0 sites in which it is impossible to use all the features unless JavaScript is fully functioning. Sometimes it is nice just to give the user a little message that lets them know they might be missing something good ;) Brian On Apr 21, 8:43 am, Felix Geisendörfer [EMAIL PROTECTED] wrote: Detecting if JavaScript is enabled is actually fairly straightforward. No need to make it so complicated. Well I think this thread is about how to detect if JS is enabled on the Server-side ; ). Your method of course is the way to go if all one needs is to display a msg to the user. -- Felix --http://www.thinkingphp.orghttp://www.fg-webdesign. de Giant Jam Sandwich wrote: Detecting if JavaScript is enabled is actually fairly straightforward. No need to make it so complicated. $(function(){ $(#is_disabled).css(display,none); }); ... div id=is_disabledYou have JavaScript disabled./div- Hide quoted text - - Show quoted text - Dual_Validation_Success.cfm Description: Binary data Dual_Validation_Form.cfm Description: Binary data
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Hi, all... the saga continues... I'm so close, yet so far. I think the problem is doc-type declarations. No matter what I do, it creates one problem or another. Now, as it is, the server-side works fine, but the client-side is disabled. Would someone please look at the attached code and tell me what the problem is? Slowly losing my mind... Rick PS - I tried attaching the docs to this email, but I guess that's not allowed. Here are links to the docs... http://bodaford.whitestonemedia.com/html/dual_validation_form.cfm http://bodaford.whitestonemedia.com/html/dual_validation_success.cfm And you can see the running pages at: http://bodaford.whitestonemedia.com/html/dual_validation_form.cfm -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Giant Jam Sandwich Sent: Saturday, April 21, 2007 9:01 AM To: jQuery (English) Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Hi Felix, Rick's original question didn't specify server side... I only skimmed the messages thereafter, so that might have come out later in the thread... me being lazy on a Saturday :)
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick Faircloth wrote: Is there a fool-proof way to determine if a user has Javascript enabled in their browser? From the server side? No. From the client? Just try it. Often, the trick is to make the site function reasonably even if JS is off. One ugly technique that I've used on occasion is to have an initial page with some JS that changes all links and forms to tell the server that from now on, it can assume that JS is on. But if the user turns off JS in the middle of using my site, this fails miserably. And if there are multiple entry points (bookmarks anyone?) it would have to be done on multiple pages. It's not fun. I suppose that AJAX-y methods would make this a bit easier now, but I would not ever recommend this technique. Instead, I would simply make sure that the site works, even if more awkwardly, without JS and then have the JS dynamically make whatever changes are needed to make the pages sexier. -- Scott
[jQuery] Re: Best way to determine if a user has Javascript enabled?
From where? If javascript runs, they have it enabled - if it doesn't, they don't! Are you wanting to pass this information to your server? Something like the following should work for that: a id='js_detect' href='/foo.php'Load/a script type='text/javascript'!-- $(document).ready(function() { var href = $(#js_detect).attr(href); href += ?javascript=true; $(#js_detect).attr(href, href); }); // -- /script If the user doesn't have javascript or it's not enabled, the href won't be changed. HTH, rob On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? Rick -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 There's a whale there's a whale there's a whale fish he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Simple way to do it might be to use javascript itself to do a forward or something like that. I've seen people set up a meta refresh of 5 seconds in the header, then use javascript to do a location.href as soon as the page loads. If they have js, they get redirected immediately to page A, if they don't, then after 5 seconds, they get redirected to page B. Thoughts? -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Friday, April 20, 2007 7:57 AM To: jquery-en@googlegroups.com Subject: [jQuery] Best way to determine if a user has Javascript enabled? Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? Rick
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Well said, Dan. On 4/20/07, Dan G. Switzer, II [EMAIL PROTECTED] wrote: As discussed on another mailing list, there's no real need to detect if JS is enabled. If you write unobtrusive JavaScript (which is what jQuery helps you to do) if the user has JS disabled, things will continue to work. There's no reason to have separate JS/non-JS pages in most cases--especially for the kind of things you're working on. That said, the most full proof way I'm aware of to test if JS is enabled/disabled is driving traffic through a splash page which does a redirect. meta http-equiv=refresh content=2;url=page.htm?js=false script type=text/javascript self.location = page.htm?js=true; /script In this example if JS is enabled, the JS code would be executed redirecting the user to page w/a URL parameter indicating that JS was enabled. If the JS code doesn't execute, then the meta refresh would take over. However, I can't emphasis this enough, testing for JS is really unnecessary for all the work you've been talking about. You keep saying you want to make your code easier to manage and develop and detecting for JS in this case is just adding more complexity. It's much easier to just write the JS and if it doesn't execute then let the server-side code re-enforce the behavior. The last time I wrote any kind of detection script, was for a project that required Flash. It's been 9 years since I've written a script to detect for JS--and that was because I didn't know better. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
One thing to point out about mine and Dan's suggestion is that your Seach engine ranking will take a hit if you use this method. Google penalizes sites who use redirects to other pages. Depending on why you need to check for JS, you might consider using this method only for portions of the site which will not receive search engine hits. Such as admin areas, online forms, etc. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Friday, April 20, 2007 8:16 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Rick, Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? As discussed on another mailing list, there's no real need to detect if JS is enabled. If you write unobtrusive JavaScript (which is what jQuery helps you to do) if the user has JS disabled, things will continue to work. There's no reason to have separate JS/non-JS pages in most cases--especially for the kind of things you're working on. That said, the most full proof way I'm aware of to test if JS is enabled/disabled is driving traffic through a splash page which does a redirect. meta http-equiv=refresh content=2;url=page.htm?js=false script type=text/javascript self.location = page.htm?js=true; /script In this example if JS is enabled, the JS code would be executed redirecting the user to page w/a URL parameter indicating that JS was enabled. If the JS code doesn't execute, then the meta refresh would take over. However, I can't emphasis this enough, testing for JS is really unnecessary for all the work you've been talking about. You keep saying you want to make your code easier to manage and develop and detecting for JS in this case is just adding more complexity. It's much easier to just write the JS and if it doesn't execute then let the server-side code re-enforce the behavior. The last time I wrote any kind of detection script, was for a project that required Flash. It's been 9 years since I've written a script to detect for JS--and that was because I didn't know better. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Hi, Dan... and thanks for the feedback... What I would like to do is allow ColdFusion server-side validation messages to be delivered back to the form page via Ajax if JS is available and, if not, just refresh the page. Isn't that what you do with this code is your ex2.3_mailing_list_validation.cfm example for the ex2_process.cfm page? Rick Your code: !---// if this is an AJAX call, we must return JSON data //--- cfif structKeyExists(url, ajax) and url.ajax !---// clear all generated data //--- cfcontent type=text/xml reset=true / cfoutput{ success: #stAction.success#, message: #jsStringFormat(stAction.message)# [AJAX] }/cfoutput cfexit method=exitTemplate / cfelse !---// reload mailing list page, which will show any errors //--- cfinclude template=#form.formUrl# / cfexit method=exitTemplate / /cfif -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Friday, April 20, 2007 9:16 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Rick, Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? As discussed on another mailing list, there's no real need to detect if JS is enabled. If you write unobtrusive JavaScript (which is what jQuery helps you to do) if the user has JS disabled, things will continue to work. There's no reason to have separate JS/non-JS pages in most cases--especially for the kind of things you're working on. That said, the most full proof way I'm aware of to test if JS is enabled/disabled is driving traffic through a splash page which does a redirect. meta http-equiv=refresh content=2;url=page.htm?js=false script type=text/javascript self.location = page.htm?js=true; /script In this example if JS is enabled, the JS code would be executed redirecting the user to page w/a URL parameter indicating that JS was enabled. If the JS code doesn't execute, then the meta refresh would take over. However, I can't emphasis this enough, testing for JS is really unnecessary for all the work you've been talking about. You keep saying you want to make your code easier to manage and develop and detecting for JS in this case is just adding more complexity. It's much easier to just write the JS and if it doesn't execute then let the server-side code re-enforce the behavior. The last time I wrote any kind of detection script, was for a project that required Flash. It's been 9 years since I've written a script to detect for JS--and that was because I didn't know better. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Thanks for the info, Rob. The purpose here is to determine how my server-side form validation results will be sent back to the form page. If JS is enabled, then I can use Ajax to send them back, if not, then the page will have to be refreshed. This is very important for forms that are embedded in the middle of a page where refreshing the page would cause the user to have to scroll back down to the form to see the results if a refresh is used. Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rob Desbois Sent: Friday, April 20, 2007 9:14 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? From where? If javascript runs, they have it enabled - if it doesn't, they don't! Are you wanting to pass this information to your server? Something like the following should work for that: a id='js_detect' href='/foo.php'Load/a script type='text/javascript'!-- $(document).ready(function() { var href = $(#js_detect).attr(href); href += ?javascript=true; $(#js_detect).attr(href, href); }); // -- /script If the user doesn't have javascript or it's not enabled, the href won't be changed. HTH, rob On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? Rick -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 There's a whale there's a whale there's a whale fish he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick Faircloth schrieb: If JS is enabled, then I can use Ajax to send them back, if not, then the page will have to be refreshed. If you use JavaScript in the sense of Progressive Enhancement, this should be no problem at all. First build your form working in the traditional way, afterwards you plug JavaScript on top and improve the user experience. In case JS is disabled, everything still works fine. -- Klaus
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick Faircloth wrote: I'm trying to take Progressive Enhancement, as I see it, one step further by integrating the enhancement into the server-side process, where possible and applicable. I think this is going to be difficult, if you are trying to drive it from the server-side. This part concerns return validation result messages back to the form page, or rather back to the page itself, since I'm currently posting the form back to the page its own. If JS is disabled, then I would simply have to refresh the page. If JS is enabled, then I could use taconite to place messages on the page without refresh...if I'm understanding everything correctly. But the server is not choosing whether it can refresh part of a page. It's simply responding to a request. If the request asks for the data needed to refresh part of the page, then it should send just that data. If the request is a form submission, the browser won't be ready to handle just the validation data; it's expecting a whole page. So the server must supply a whole page at that point. It's relatively straightforward to progressively enhance the page to convert a submit form request into an initial AJAX validation request, followed by either error reporting or actual form submission. The harder part is to determine how to deal with this server side. Basically, you want a component model server side that can do several different things dependent upon how the request is made: serve the form as part of the initial page, serve the form back in the page with validation messages, or return the validation messages in response to an AJAX request. My biggest question with my server-side code is how to make sure these three related tasks are handled efficiently without code duplication. Cheers, -- Scott Sauyet
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick, That would work if the form were visible when the page is first opened, (And I may have to go that route if what I'm trying doesn't work...), but when the page is first opened, the form is invisible and a link has to be clicked to even view the form. So a named anchor wouldn't provide *exactly* what I'm looking for, but may be a compromise. Well, if you're doing that then you're requiring JS to even fill out the form to begin with. If that's the case, then you can just use JS to show the form and move to the anchor. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick, !---// if this is an AJAX call, we must return JSON data //--- cfif structKeyExists(url, ajax) and url.ajax !---// clear all generated data //--- cfcontent type=text/xml reset=true / cfoutput{ success: #stAction.success#, message: #jsStringFormat(stAction.message)# [AJAX] }/cfoutput cfexit method=exitTemplate / Don't pay too much attention to the ex2_process.cfm in the example. It's used for all of the ex2.1*.cfm templates. For the ex2.3_mailing_list_validation.cfm example, the code above would *never* be executed. I just sent another message that hopefully will clear things up for you. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Thanks for the feedback, Rey. I'm feel certain that the feedback I'm getting will be correct. I just wanted to ask the questions to be sure. Dan's demo code caused me a lot of confusion, because it seemed to be doing exactly what I'm looking for. I'll try one more approach and that is (as I've done already) to display server-side validation messages via taconite, but if that should fail (and I'll have to figure out some way to flag that failure) have CF goes ahead and display the messages as I've done for years. I'm sure you can all excuse a newbie to JS in general and jQuery in particular for exploring the boundaries of what is possible! :o) Thanks for your patience. Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rey Bango Sent: Friday, April 20, 2007 10:35 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Hi Rick, Let me summarize what everyone is saying before this turns into a long thread. Basically, there's no easy and surefire way of determining if JS is enabled on the browser. You need to code your forms and pages in the traditional way that you would any non-JS application. Once you have those pages working correctly with proper server-side validation and handling, then you can look at progressive enhancement to extend the functionality of your pages by leveraging JS, DOM-manipulation and Ajax. I realize that you're trying to find a way of doing this from a server-side perspective but you're going to end up building a hodge-podge solution that will not be effective. You have some really sharp people giving you the right advice and since I want you to be successful, I highly recommend that you follow their suggestions. This is the *only* surefire way of ensuring that browsers that have JS disabled will work properly on your site. Otherwise, its a shot in the dark. Rey... Rick Faircloth wrote: That's what's motivating the question. I'm trying to take Progressive Enhancement, as I see it, one step further by integrating the enhancement into the server-side process, where possible and applicable. This part concerns return validation result messages back to the form page, or rather back to the page itself, since I'm currently posting the form back to the page its own. If JS is disabled, then I would simply have to refresh the page. If JS is enabled, then I could use taconite to place messages on the page without refresh...if I'm understanding everything correctly. Rick
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick, Isn't that what you do with this code is your ex2.3_mailing_list_validation.cfm example for the ex2_process.cfm page? Since it's obvious that you've downloaded my presentation, I need to point out that some of the things in the demo are bad concepts, but I did them to show the progression of how you get from point A to point D. For example, the ex2.4_mailing_list_ajax.cfm is a horrible idea for validation. For my presentation though, I wanted to isolate the portion that should how one could validate against server-side lookups. The final goal was to get to ex2.5_mailing_list_validation_ajax.cfm. This template shows using pure client-side validation to validate absolutely everything you could on the client-side, while using AJAX only when you couldn't validate w/out looking something up on the server. It also shows how all the JS code in unobtrusive and the form still works without JS. So, whatever you do, you should not use ex2.4_mailing_list_ajax.cfm as a model for validation--it would be taken out of context and be a very bad implementation. For those of you interested in the presentation files, you can download it here: http://blog.pengoworks.com/blogger/index.cfm?action=blog:585 -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
That page has no AJAX based validation. I also do no JS detection. The code is set up so that if JS is unavailable, the form just works. I got that, but the code seems to test for Ajax availability, and if there's been an Ajax call, it responds with messages via Ajax. If the call was not via Ajax, then the validation responses are returned via template inclusion, rather than refresh, which worked for the purposes of your demo, but I'm not sure how that technique would work on a real website. But if I'm wrong about my explanation above, please explain to me what your code does: !---// if this is an AJAX call, we must return JSON data //--- cfif structKeyExists(url, ajax) and url.ajax !---// clear all generated data //--- cfcontent type=text/xml reset=true / cfoutput{ success: #stAction.success#, message: #jsStringFormat(stAction.message)# [AJAX] }/cfoutput cfexit method=exitTemplate / -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Friday, April 20, 2007 10:07 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Rick, Isn't that what you do with this code is your ex2.3_mailing_list_validation.cfm example for the ex2_process.cfm page? That page has no AJAX based validation. I also do no JS detection. The code is set up so that if JS is unavailable, the form just works. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick, Isn't that what you do with this code is your ex2.3_mailing_list_validation.cfm example for the ex2_process.cfm page? That page has no AJAX based validation. I also do no JS detection. The code is set up so that if JS is unavailable, the form just works. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Beat me to it. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andy Matthews Sent: Friday, April 20, 2007 8:19 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Simple way to do it might be to use javascript itself to do a forward or something like that. I've seen people set up a meta refresh of 5 seconds in the header, then use javascript to do a location.href as soon as the page loads. If they have js, they get redirected immediately to page A, if they don't, then after 5 seconds, they get redirected to page B. Thoughts? -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Friday, April 20, 2007 7:57 AM To: jquery-en@googlegroups.com Subject: [jQuery] Best way to determine if a user has Javascript enabled? Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? Rick
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Thanks for pointing that out, Andy. That's important for me to know, because I not only design and develop sites for clients, more and more are asking me to perform SEO/SEM for them and I don't want to hurt their rankings, for sure! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andy Matthews Sent: Friday, April 20, 2007 9:37 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? One thing to point out about mine and Dan's suggestion is that your Seach engine ranking will take a hit if you use this method. Google penalizes sites who use redirects to other pages. Depending on why you need to check for JS, you might consider using this method only for portions of the site which will not receive search engine hits. Such as admin areas, online forms, etc. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Friday, April 20, 2007 8:16 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Rick, Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? As discussed on another mailing list, there's no real need to detect if JS is enabled. If you write unobtrusive JavaScript (which is what jQuery helps you to do) if the user has JS disabled, things will continue to work. There's no reason to have separate JS/non-JS pages in most cases--especially for the kind of things you're working on. That said, the most full proof way I'm aware of to test if JS is enabled/disabled is driving traffic through a splash page which does a redirect. meta http-equiv=refresh content=2;url=page.htm?js=false script type=text/javascript self.location = page.htm?js=true; /script In this example if JS is enabled, the JS code would be executed redirecting the user to page w/a URL parameter indicating that JS was enabled. If the JS code doesn't execute, then the meta refresh would take over. However, I can't emphasis this enough, testing for JS is really unnecessary for all the work you've been talking about. You keep saying you want to make your code easier to manage and develop and detecting for JS in this case is just adding more complexity. It's much easier to just write the JS and if it doesn't execute then let the server-side code re-enforce the behavior. The last time I wrote any kind of detection script, was for a project that required Flash. It's been 9 years since I've written a script to detect for JS--and that was because I didn't know better. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick Faircloth wrote: The simplest thing is just to add a post parameter that says ajaxOn=true or some such, then check for that server-side. It wasn't included in the HTML, or it was set to false, so if it's true, the server knows to respond with an AJAX request. It's pretty straightforward. Well, then, wouldn't that amount to a fool-proof test that Ajax is available for the server to use as a response mechanism? Yes, that's what a number of people have been trying to tell you. There is no useful way for the server side to determine if JS is on, but the client side can easily *tell* that to the server side. And I assume by add a post parameter, you mean a hidden field in the form or somewhere in the JS code on the calling page with a variable? Yes, although it could also be done through a parameter added to the query string or the URL, depending upon how you want to handle it server side. But the other option, suggested on this thread, to use the HTTP header HTTP_X_REQUESTED_WITH means no extra work in the JS, and is probably a better idea, as long as you are sure you will be using JQuery for a while. Good luck, -- Scott
[jQuery] Re: Best way to determine if a user has Javascript enabled?
The only question now is whether or not HTTP_X_REQUESTED_WITH is compatible with ColdFusion 4.5... the client side can easily *tell* that to the server side It doesn't really matter how the server-side knows, as long as it knows :o) And a question about adding it to a URL... how does the client-side page determine whether JS is available or not before any code is executed? What's the means of determine wither to add .cfm?Ajax=False or .cfm?Ajax=True ? -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Scott Sauyet Sent: Friday, April 20, 2007 11:50 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Rick Faircloth wrote: The simplest thing is just to add a post parameter that says ajaxOn=true or some such, then check for that server-side. It wasn't included in the HTML, or it was set to false, so if it's true, the server knows to respond with an AJAX request. It's pretty straightforward. Well, then, wouldn't that amount to a fool-proof test that Ajax is available for the server to use as a response mechanism? Yes, that's what a number of people have been trying to tell you. There is no useful way for the server side to determine if JS is on, but the client side can easily *tell* that to the server side. And I assume by add a post parameter, you mean a hidden field in the form or somewhere in the JS code on the calling page with a variable? Yes, although it could also be done through a parameter added to the query string or the URL, depending upon how you want to handle it server side. But the other option, suggested on this thread, to use the HTTP header HTTP_X_REQUESTED_WITH means no extra work in the JS, and is probably a better idea, as long as you are sure you will be using JQuery for a while. Good luck, -- Scott
[jQuery] Re: Best way to determine if a user has Javascript enabled?
-Original Message- From: Scott Sauyet [mailto:[EMAIL PROTECTED] header HTTP_X_REQUESTED_WITH means no extra work in the JS, and is probably a better idea, as long as you are sure you will be using JQuery This sounds like the best way - I think you were using CF right? Maybe try: GetHttpRequestData Description Makes HTTP request headers and body available to CFML pages. Useful for capturing SOAP request data, which can be delivered in an HTTP header. As far as populating the hidden form field - I got this code from Dan's autocomplete example: function findValue(li) { if( li == null ) return alert(No matching records found!); // if coming from an AJAX call, let's use the CityId as the value if( !!li.extra ) var sValue = li.extra[0]; // otherwise, let's just display the value in the text box else var sValue = li.selectValue; // write the id to a hidden field $(#public_id).val(sValue); } It's basically looking for a value in a list and assigning that to my field (public_id) Jim
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Gotcha... (Hopefully it's compatible with CF 4.5!) Your approach looks like what Dan did in his presentation code: cfif structKeyExists(url, ajax) and url.ajax Checking for the ajax variable in the url struct... at least that's how I'm understand it... -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Friday, April 20, 2007 11:56 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? -Original Message- From: Scott Sauyet [mailto:[EMAIL PROTECTED] header HTTP_X_REQUESTED_WITH means no extra work in the JS, and is probably a better idea, as long as you are sure you will be using JQuery This sounds like the best way - I think you were using CF right? Maybe try: GetHttpRequestData Description Makes HTTP request headers and body available to CFML pages. Useful for capturing SOAP request data, which can be delivered in an HTTP header. As far as populating the hidden form field - I got this code from Dan's autocomplete example: function findValue(li) { if( li == null ) return alert(No matching records found!); // if coming from an AJAX call, let's use the CityId as the value if( !!li.extra ) var sValue = li.extra[0]; // otherwise, let's just display the value in the text box else var sValue = li.selectValue; // write the id to a hidden field $(#public_id).val(sValue); } It's basically looking for a value in a list and assigning that to my field (public_id) Jim
[jQuery] Re: Best way to determine if a user has Javascript enabled?
-Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 12:00 PM (Hopefully it's compatible with CF 4.5!) Unfortunately it looks like it was introduced in v5: http://www.actcfug.com/files/cfmlhistory/functions/gethttprequestdata.ht m You need to put down the Ajax and upgrade your CF :) Jim
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Waiting for CF 8... -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Friday, April 20, 2007 12:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 12:00 PM (Hopefully it's compatible with CF 4.5!) Unfortunately it looks like it was introduced in v5: http://www.actcfug.com/files/cfmlhistory/functions/gethttprequestdata.ht m You need to put down the Ajax and upgrade your CF :) Jim
[jQuery] Re: Best way to determine if a user has Javascript enabled?
In the meantime, I suppose you could use JavaScript to append a variable to the URL, and then have your CF decide what to send based on the presence of that variable. Example: html script type=text/javascript $(function() { var $exampleForm = $(#exampleForm); var oldAction = $exampleForm.attr(action); $exampleForm.attr(action, oldAction + ?isAjax=true); }); /script form id=exampleForm action=example.cfm !-- Form fields go here -- /form /html For the form is initially hidden thing, you could use JavaScript to hide the form in a $(document).ready() function. That way people without JS see the form, and people with JS see what you originally wanted them to. On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Waiting for CF 8... -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Friday, April 20, 2007 12:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 12:00 PM (Hopefully it's compatible with CF 4.5!) Unfortunately it looks like it was introduced in v5: http://www.actcfug.com/files/cfmlhistory/functions/gethttprequestdata.ht m You need to put down the Ajax and upgrade your CF :) Jim -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Looks good.. let's make sure I understand. So if JS is enabled, the script will run, appending ?isAjax=true to whatever page is specified if my form's action page. correct? Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 1:22 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? In the meantime, I suppose you could use JavaScript to append a variable to the URL, and then have your CF decide what to send based on the presence of that variable. Example: html script type=text/javascript $(function() { var $exampleForm = $(#exampleForm); var oldAction = $exampleForm.attr(action); $exampleForm.attr(action, oldAction + ?isAjax=true); }); /script form id=exampleForm action=example.cfm !-- Form fields go here -- /form /html For the form is initially hidden thing, you could use JavaScript to hide the form in a $(document).ready() function. That way people without JS see the form, and people with JS see what you originally wanted them to. On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Waiting for CF 8... -Original Message- From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com mailto:jquery-en@googlegroups.com ] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Friday, April 20, 2007 12:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 12:00 PM (Hopefully it's compatible with CF 4.5!) Unfortunately it looks like it was introduced in v5: http://www.actcfug.com/files/cfmlhistory/functions/gethttprequestdata.ht m You need to put down the Ajax and upgrade your CF :) Jim -- Aaron Heimlich Web Developer [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Didn't read the entire thread but appending parameters like this to an url just doesn't seem right to me. Maybe your problem can be solved by looking if the client sent a X-Requested-With == 'XMLHttpRequest' header. That's how we in CakePHP find out if a page was requested via Ajax or not ; ). Note: This is nothing the XMLHttpRequest adds itself, but I know jQuery and also Prototype do it for all their ajax requests for you. -- Felix -- http://www.thinkingphp.org http://www.fg-webdesign.de
[jQuery] Re: Best way to determine if a user has Javascript enabled?
On 4/20/07, Felix Geisendörfer [EMAIL PROTECTED] wrote: Didn't read the entire thread but appending parameters like this to an url just doesn't seem right to me. I would normally agree, but Rick is using ColdFusion 4.5, which apparently isn't capable of inspecting HTTP Headers. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Best way to determine if a user has Javascript enabled?
On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: $(document).ready()(function { \n Should be: $(document).ready(function() { // stuff goes here... }); -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Best way to determine if a user has Javascript enabled?
That was the problem. now I'm getting the Query String. Now I've got see if I can make all of this work. Thanks! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 3:37 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: $(document).ready()(function { \n Should be: $(document).ready(function() { // stuff goes here... }); -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Question: What typically causes the Firebug message The XML file does not appear to have any style information associated with it. The document tree is shown below. to display? I have hunted for this problem forever and can't see what's wrong. I'll provide code, but I just thought there might be something that's usually wrong when this pops up. Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Friday, April 20, 2007 4:09 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? That was the problem. now I'm getting the Query String. Now I've got see if I can make all of this work. Thanks! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 3:37 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: $(document).ready()(function { \n Should be: $(document).ready(function() { // stuff goes here... }); -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Best way to determine if a user has Javascript enabled?
On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: The XML file does not appear to have any style information associated with it. The document tree is shown below. This is what FireFOX (not Firebug) does when you browse to an XML file that isn't using any XSLT stylesheets (and I would guess CSS as well, but I dunno). Seeing this doesn't necessarily mean that something went wrong, though (unless you're actually trying to use XSLT or something). Is the page in question supposed to return XML? If not, you should be sure that you're sending the appropriate Content-Type for whatever that page should be sending. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Thanks for the feedback, Aaron. I'm trying to integrate the whole validation scheme into one page. I'm following an example given to me that does work, but using my own code, of course. I've got something wrong somewhere. I'll tinker some more and then if I can't figure it out, I'll post some code. Thanks for the tip. at least now I have some idea of what to look for! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 6:23 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: The XML file does not appear to have any style information associated with it. The document tree is shown below. This is what FireFOX (not Firebug) does when you browse to an XML file that isn't using any XSLT stylesheets (and I would guess CSS as well, but I dunno). Seeing this doesn't necessarily mean that something went wrong, though (unless you're actually trying to use XSLT or something). Is the page in question supposed to return XML? If not, you should be sure that you're sending the appropriate Content-Type for whatever that page should be sending. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Is it possible to submit a page back to itself using a regular submit button, then process the data from the form using taconite commands? I've run into a dead end. I can't seem to figure out how to submit a form with a regular submit button and then have taconite handle the data that comes back to the page. I'm using the script I was given to attach ?isAjax=true to my URL, and I was thinking that all I had to do was use taconite's replaceContent command to place the error messages back on the page with the form without refreshing the page. I've been thinking about this so long, I think I'm having a brain cramp. The problem seems to be that with a regular submission, I can't get the data being returned to the page in the xml format so taconite can parse it. I was given an example where all validation (no server-side validation) was done on a single page. The page was wrapped by: CFIF IsDefined(Form.Fieldnames) CFINCLUDE for cf processing of data CFCONTENT type=text/html reset=yes CFHEADER name=Content-Type value=text/xml CFOUTPUT oTaconite replaceContent for selects /CFOUTPUT CFELSE HTML xmlns=http://www.w3.org/1999/xhtml HEAD META http-equiv=Content-Type content=text/html; charset=iso-8859-1 / BODY Now the actual page content. scripts, including one that posts back to the same page ( I guess this is the Ajax post. $.post(CalcTest.cfm, Params); ), then the body, including the form (no submit button, everything is posted on blur) /BODY /HTML /CFIF The CFIF wrap of the page seems to prevent the return of non-xml data to the taconite plug-in, preventing what I'm getting now. XML Parsing Error: not well-formed. Am I just missing something or is it impossible to do this sort of thing at all if server-side processing is involved? I guess the question I have to have answered now is whether or not data can be sent back to the page that posted it in a form that the taconite plug-in can process it, if the data wasn't sent via Ajax from the page to begin with. Forgive me if this doesn't make any sense. it's not making much right now to me, either. I'm about ready to call it quits on client-side validation. I'm not sure it's worth all this trouble since server-side validation has to be performed anyway. Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Friday, April 20, 2007 6:55 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Thanks for the feedback, Aaron. I'm trying to integrate the whole validation scheme into one page. I'm following an example given to me that does work, but using my own code, of course. I've got something wrong somewhere. I'll tinker some more and then if I can't figure it out, I'll post some code. Thanks for the tip. at least now I have some idea of what to look for! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 6:23 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: The XML file does not appear to have any style information associated with it. The document tree is shown below. This is what FireFOX (not Firebug) does when you browse to an XML file that isn't using any XSLT stylesheets (and I would guess CSS as well, but I dunno). Seeing this doesn't necessarily mean that something went wrong, though (unless you're actually trying to use XSLT or something). Is the page in question supposed to return XML? If not, you should be sure that you're sending the appropriate Content-Type for whatever that page should be sending. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Show me exactly what XML you are attempting to return, I'm semi-familiar with Taconite so I should be able to make some sense of it. Also, I'm no CF whiz, but this doesn't make a whole lot of sense to me CFCONTENT type=text/html reset=yes CFHEADER name=Content-Type value=text/xml From what I understand from the ColdFusion 4.5 CFML Reference[1], CFCONTENT sets the Content-Type of the page, and the CFHEADER tag you're using is doing the same thing. Try this, though (be warned, I have *very* limited knowledge of CF) CFIF IsDefined(URL.isAjax) CFINCLUDE for cf processing of data CFHEADER name=Content-Type value=text/xml CFOUTPUT taconite !-- your taconite stuff here -- /taconite /CFOUTPUT CFELSE HTML xmlns=http://www.w3.org/1999/xhtml HEAD META http-equiv=Content-Type content=text/html; charset=iso-8859-1 / BODY Now the actual page content… scripts, including one that posts back to the same page ( I guess this is the Ajax post… $.post(CalcTest.cfm, Params); ), then the body, including the form (no submit button, everything is posted on blur) /BODY /HTML /CFIF [1] http://download.macromedia.com/pub/documentation/en/coldfusion/452/45langref.pdf On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Is it possible to submit a page back to itself using a regular submit button, then process the data from the form using taconite commands? I've run into a dead end… I can't seem to figure out how to submit a form with a regular submit button and then have taconite handle the data that comes back to the page. I'm using the script I was given to attach ?isAjax=true to my URL, and I was thinking that all I had to do was use taconite's replaceContent command to place the error messages back on the page with the form without refreshing the page. I've been thinking about this so long, I think I'm having a brain cramp. The problem seems to be that with a regular submission, I can't get the data being returned to the page in the xml format so taconite can parse it. I was given an example where all validation (no server-side validation) was done on a single page. The page was wrapped by: CFIF IsDefined(Form.Fieldnames) CFINCLUDE for cf processing of data CFCONTENT type=text/html reset=yes CFHEADER name=Content-Type value=text/xml CFOUTPUT oTaconite replaceContent for selects /CFOUTPUT CFELSE HTML xmlns=http://www.w3.org/1999/xhtml HEAD META http-equiv=Content-Type content=text/html; charset=iso-8859-1 / BODY Now the actual page content… scripts, including one that posts back to the same page ( I guess this is the Ajax post… $.post(CalcTest.cfm, Params); ), then the body, including the form (no submit button, everything is posted on blur) /BODY /HTML /CFIF The CFIF wrap of the page seems to prevent the return of non-xml data to the taconite plug-in, preventing what I'm getting now… XML Parsing Error: not well-formed… Am I just missing something or is it impossible to do this sort of thing at all if server-side processing is involved? I guess the question I have to have answered now is whether or not data can be sent back to the page that posted it in a form that the taconite plug-in can process it, if the data wasn't sent via Ajax from the page to begin with. Forgive me if this doesn't make any sense… it's not making much right now to me, either. I'm about ready to call it quits on client-side validation. I'm not sure it's worth all this trouble since server-side validation has to be performed anyway… Rick *From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Rick Faircloth *Sent:* Friday, April 20, 2007 6:55 PM *To:* jquery-en@googlegroups.com *Subject:* [jQuery] Re: Best way to determine if a user has Javascript enabled? Thanks for the feedback, Aaron… I'm trying to integrate the whole validation scheme into one page. I'm following an example given to me that does work, but using my own code, of course. I've got something wrong somewhere. I'll tinker some more and then if I can't figure it out, I'll post some code. Thanks for the tip… at least now I have some idea of what to look for! Rick *From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Aaron Heimlich *Sent:* Friday, April 20, 2007 6:23 PM *To:* jquery-en@googlegroups.com *Subject:* [jQuery] Re: Best way to determine if a user has Javascript enabled? On 4/20/07, *Rick Faircloth* [EMAIL PROTECTED] wrote: The XML file does not appear to have any style information associated with it. The document tree is shown below. This is what FireFOX (not Firebug) does when you browse to an XML file that isn't using any XSLT stylesheets (and I would guess CSS as well, but I dunno). Seeing this doesn't necessarily mean that something
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Let me rewrite and rearrange the code and I'll show it to you tomorrow and see what you think. Thanks for your input and help, Aaron. Time for some sleep! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 10:47 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Show me exactly what XML you are attempting to return, I'm semi-familiar with Taconite so I should be able to make some sense of it. Also, I'm no CF whiz, but this doesn't make a whole lot of sense to me CFCONTENT type=text/html reset=yes CFHEADER name=Content-Type value=text/xml From what I understand from the ColdFusion 4.5 CFML Reference[1], CFCONTENT sets the Content-Type of the page, and the CFHEADER tag you're using is doing the same thing. Try this, though (be warned, I have *very* limited knowledge of CF) CFIF IsDefined(URL.isAjax) CFINCLUDE for cf processing of data CFHEADER name=Content-Type value=text/xml CFOUTPUT taconite !-- your taconite stuff here -- /taconite /CFOUTPUT CFELSE HTML xmlns= http://www.w3.org/1999/xhtml HEAD META http-equiv=Content-Type content=text/html; charset=iso-8859-1 / BODY Now the actual page content. scripts, including one that posts back to the same page ( I guess this is the Ajax post. $.post(CalcTest.cfm, Params); ), then the body, including the form (no submit button, everything is posted on blur) /BODY /HTML /CFIF [1] http://download.macromedia.com/pub/documentation/en/coldfusion/452/45langref .pdf On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Is it possible to submit a page back to itself using a regular submit button, then process the data from the form using taconite commands? I've run into a dead end. I can't seem to figure out how to submit a form with a regular submit button and then have taconite handle the data that comes back to the page. I'm using the script I was given to attach ?isAjax=true to my URL, and I was thinking that all I had to do was use taconite's replaceContent command to place the error messages back on the page with the form without refreshing the page. I've been thinking about this so long, I think I'm having a brain cramp. The problem seems to be that with a regular submission, I can't get the data being returned to the page in the xml format so taconite can parse it. I was given an example where all validation (no server-side validation) was done on a single page. The page was wrapped by: CFIF IsDefined(Form.Fieldnames) CFINCLUDE for cf processing of data CFCONTENT type=text/html reset=yes CFHEADER name=Content-Type value=text/xml CFOUTPUT oTaconite replaceContent for selects /CFOUTPUT CFELSE HTML xmlns=http://www.w3.org/1999/xhtml HEAD META http-equiv=Content-Type content=text/html; charset=iso-8859-1 / BODY Now the actual page content. scripts, including one that posts back to the same page ( I guess this is the Ajax post. $.post(CalcTest.cfm, Params); ), then the body, including the form (no submit button, everything is posted on blur) /BODY /HTML /CFIF The CFIF wrap of the page seems to prevent the return of non-xml data to the taconite plug-in, preventing what I'm getting now. XML Parsing Error: not well-formed. Am I just missing something or is it impossible to do this sort of thing at all if server-side processing is involved? I guess the question I have to have answered now is whether or not data can be sent back to the page that posted it in a form that the taconite plug-in can process it, if the data wasn't sent via Ajax from the page to begin with. Forgive me if this doesn't make any sense. it's not making much right now to me, either. I'm about ready to call it quits on client-side validation. I'm not sure it's worth all this trouble since server-side validation has to be performed anyway. Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Friday, April 20, 2007 6:55 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Thanks for the feedback, Aaron. I'm trying to integrate the whole validation scheme into one page. I'm following an example given to me that does work, but using my own code, of course. I've got something wrong somewhere. I'll tinker some more and then if I can't figure it out, I'll post some code. Thanks for the tip. at least now I have some idea of what to look for! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 6:23 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript