jquery - How to check Javascripts are disabled by proxy -


i not know weather there way solve or not, i'm asking because believe place of genius people. anyways, know if use <noscript></noscript> tag within html document , if user viewing page , have javascript disabled browser see no script message. if javascript has been disabled proxy? many wifi networks needs manually input proxy use internet , many of them disabled js on proxy proxy server. in case if visit same page, page see javascript has been enabled browser, disabled proxy. if there way check weather javascript has been disabled proxy(if using) , showing alert message this? glad if can how implement wordpress , without wordpress. :)

thanks.

you can show message default , remove or hide javascript, e.g.:

<div id="jsalert">javascript disabled in environment.</div> <script> (function() {     var elm = document.getelementbyid("jsalert");     elm.parentnode.removechild(elm); })(); </script> <!-- continue content here --> 

if script tags have been stripped proxy (which i'm very unusual; @ least, i've never seen it), of course script won't there run, , div show. if script present, remove div.

by following div script immediately (which perfectly fine, no need "dom ready" stuff delay things), odds of div "flashing" briefly on page in common case (where javascript enabled , not stripped out) low. not zero, low.

if believe proxy doesn't strip out script tags instead blocks downloads of javascript files (which dumb), can change above use javascript file, beware doing either hold rendering of page (if use <script src="...">) or increase (dramatically) odds of div "flashing" on page briefly (if load script asynchronously).

this specific use-case general practice called "progressive enhancement" (or "graceful degradation," people prefer first). that's ensure page presented correctly , usefully in case javascript not available, , use javascript add behaviors page if javascript enabled. in case, "useful" thing you're doing saying javascript isn't running reason, it's different thing, it's same principle.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -