Sunday, 15 September 2013

Javascript, to only run if the user is on IE10 -



Javascript, to only run if the user is on IE10 -

i using library works on browsers apart ie10 button requires double click instead of 1, want create javascript run on ie10 when user clicks on button double click instead of single, how can create runs in ie10.

edit :

this code having issues :

<p:fileupload widgetvar="upload" id="upload" fileuploadlistener="#{fileuploadcontroller.handlefileupload}" mode="advanced" multiple="false" update="messages nav upload" label="select file" sizelimit="100000000" allowtypes="/(\.|\/)(gif|jpe?g|png|doc|docx|txt|pdf|html)$/" auto="true" disabled="#{fileuploadcontroller.uploadcomplete}" />

out of broswers tested, firefox, chrome, opera, safrai , i.e. 7 - 9 i.e.10 has isse when click upload requires double click

while it's true net explorer 10 no longer supports conditional comments in html, there less widely-used feature known "conditional compilation" still supported ie10 jscript engine.

/*@cc_on @if (@_jscript_version >= 10) console.log("you using ie10 or greater!"); @end @*/

as can see, other browsers parse /* ... */ multi-line comment , ignore ie-specific code.

when used in conjunction feature detection, conditional compilation offers powerful method of narrowing downwards ie version detection.

more likely, sounds bug library you're using. consider reporting bug authors of primefaces library rather hacking around it.

if it's library bug, , you're having issues single click vs. double click in ie10, pure feature detection may not yield appropriate results because you'd attempting observe irrelevant features. "onclick" , "ondblclick" dom0 events have been available ie ages.

furthermore, if button works ie11 onward, feature detection checking html5/css3 attributes may create hard single out ie10, or, in worst case scenario, trigger false positives. when considering dramatic changes made 1 major version of ie (8) next major version (9), want minimize threat of false positives , detection of irrelevant features much possible.

note unlike user agent sniffing (which frowned upon), jscript engine not exposed same risks such user agent spoofing. jscript engine version hard-coded , updated each major version of net explorer. (..., 6, 7, 8, 9, 10, etc.)

therefore, accurate detection of ie10 , future-proof software, conditional compilation must.

javascript

No comments:

Post a Comment