Disabling javascript script when downloading to smartphone

I use the following HTML snippet to download another stylesheet for smartphones:

media="only screen and (min-device-width: 4801x)" media="only screen and (max-device-width: 480px)" 

I would like to disable a specific javascript script for smartphone users. Is it possible? I don’t think I can do:

<script media="only screen and (max-device-width: 480px)" t ype="text/javascript" src=""/>

thanks

0
source share
2 answers

You can determine the screen resolution in javascript and then change the script execution based on the resolution. But the javascript file will still be loaded. To determine the screen size:

http://www.pageresource.com/jscript/jscreen.htm

+4
source

No, It is Immpossible.

If the phone browser does not support javascript, it does not matter. If so, you can use javascript to determine if it supports what you are looking for, and if not, distract execution either to a simpler path or to the exit altogether.

+1
source

All Articles