Would it be possible that the plugin does not call
wp_localize_script()if not on a mobile device? Some sites do not use jquery, so the extra loading could be avoided if not required.
WordPress since 3.4 has a function
wp_is_mobile()which checks the useragent for certain values and returns a boolean.
The existing checks for IOS etc. in
.jswould stay there of course.
Not sure how “safe”
wp_is_mobile()is for detection, maybe does not detect enough(?), and probably there should be a
function_exists('wp_is_mobile')as well for older WordPress versions…
- The topic ‘[Plugin: Black Studio Touch Dropdown Menu] Decide with wp_is_mobile() if plugin adds code at all?’ is closed to new replies.