rbobzin — 2013-06-10T18:43:07-04:00 — #1
Just started using jQuery in some of our sites, but would really like to know how to NOT use it if the site visitor's browser won't support it. I've searched these forums for a while now, and re-read several of the relevant e-books I got from Sitepoint, but can't seem to find anything usable about this issue.
Specifically, I'd like to add some code to the site template that would first determine if the visitor's browser supports jQuery. If it does, continue on. If it doesn't, display this instead.
Can anyone point me in the right direction?
ralphm — 2013-06-10T21:15:26-04:00 — #2
Hi rbobzin. Welcome to the forums.
I'd like to add some code to the site template that would first determine if the visitor's browser supports jQuery. If it does, continue on. If it doesn't, display this instead.
rbobzin — 2013-06-11T09:13:19-04:00 — #3
I understand that JS will be ignored if the browser doesn't support it or the user has disabled it, but I'm not sure how to set up a page so that it displays the JS content if the browser can handle it, and displays HTML-only content if it can't. It seems to me there should be some type of IF statement to control that. In other words, how do I set it up so that a JS-capable browser doesn't display both (JS and HTML-only) content?
felgall — 2013-06-11T15:50:12-04:00 — #4
There effectively is.
document.getElementById('ex').innerHTML = 'definitely';
rbobzin — 2013-06-14T20:41:26-04:00 — #5
That's what I was looking for! Thanks!