G
G
Grisha Nikolsky2016-01-12 19:52:37
JavaScript
Grisha Nikolsky, 2016-01-12 19:52:37

How to disable JS script for older browsers?

Hello. The "SmoothScroll" script is connected to my WordPress theme via functions.php, for example. I need to make it so that when opening a site in IE (any), it is disabled or ignored by the browser.
Found the following solution in PHP:

if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) $body_browser_class = 'ie';

Well and further simply before wp_enqueue_script()to put check. But in my opinion this is some kind of perverse way. Can this be done in a simpler way or in general using WP?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2016-01-12
@Stalker_RED

Why not do this check in the script itself? Or when connecting using conditional comments.
htmlbook.ru/samlayout/internet-explorer/uslovnye-k...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question