jquery - Load External JavaScript on Desktop Only -


i have went through ton of answers, , can not work me. please patient , specific newbie when comes using javascript.

i attempting external javascript file load on desktop only. below code using, not working. can please me achieve this.

<script> (function() { if( window.innerwidth > 600 ) {     var thescript = document.createelement('script');         thescript.type = 'text/javascript';         thescript.src = 'www.siteminds.net/m/1.6/mind_loader.php?pid=y2w6z8b3n31&cast_id=v1532315&autoplay=1&avname=jackie&wc=1&avnum=15&band_type=av';      var s = document.getelementsbytagname('script')[0];         s.parentnode.insertbefore(thescript, s); } })(); </script> 

i placing code in head section, however, script not running.

the website responsive using respond.js. added enquire.js in attempt use method (which couldn't work)

probably, main issue must include protocol on url so:

'www.siteminds.net/m/1.6/mind_loader.php?pid=y2w6z8b3n31&cast_id=v1532315&autoplay=1&avname=jackie&wc=1&avnum=15&band_type=av' 

needs be:

'http://www.siteminds.net/m/1.6/mind_loader.php?pid=y2w6z8b3n31&cast_id=v1532315&autoplay=1&avname=jackie&wc=1&avnum=15&band_type=av' 

your code fail if there not script tags. version not vulnerable that:

<script> (function() { if( window.innerwidth > 600 ) {     var thescript = document.createelement('script');     thescript.type = 'text/javascript';     thescript.src = 'http://www.siteminds.net/m/1.6/mind_loader.php?pid=y2w6z8b3n31&cast_id=v1532315&autoplay=1&avname=jackie&wc=1&avnum=15&band_type=av';      var head = document.getelementsbytagname('head')[0];     head.appendchild(thescript); } })(); </script> 

note: test innerwidth > 600 not close fail-proof way detect desktop installation tablet in landscape mode pass test.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -