Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
How to load script only on desktop and tablet using javascript

I want the following code to load only on desktop and tablet.

<script type="text/javascript" src="//wcs.naver.net/wcslog.js"></script>

Referring to this comment, I saved the code below as example.js and loaded it from the header.

$( document ). ready(function() {
     var isMobile = window.matchMedia("only screen and (min-width: 600px)");

     if (isMobile.matches) {
        **<script type="text/javascript" src="//wcs.naver.net/wcslog.js"></script>**
     }
  });

But the script does not loaded.

I'd like to hear some advice on how I should fix it.

Thank you

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Maybe the wp_is_mobile() function could help: https://developer.wordpress.org/reference/functions/wp_is_mobile/

I mean you can wrap the script tag within this condition and do it via PHP directly.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda