I would like to know is there any wordpress plugin or codes to detect the user using mobile/tablet and load some specific javascript?
I found online that there are some WP plugin to load theme when detected as mobile.
But is there any way to load javascript rather than themes?
You do not need an external plugin for something, which is already implemented in WordPress system.
You can use the
wp_is_mobile();
conditional tag to check if the user is visiting using a mobile device. This is a boolean function, meaning it returns eitherTRUE
orFALSE
, you can place it in yourheader.php
and then redirect the users to the proper content.