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

157
Vistas
Is there any reason why a user would not be able to load scripts if they are not inside a scripts file?

The problem

I am facing a rather weird issue where a windows 10 user is not able to load scripts if they are in script tags inside of a template file (.html). However scripts are loading fine if they are added into a script file (.js).

The problem is that I am unable to hard code everything into the script files because some values are dynamically generated. Here's a very simple example:

Ex:


   $.ajax({
      url: "{% url 'some-namespace' %}",
      type: "POST",
      data: data,
    ...

If I were to change a url pattern, then I can just do so directly in the Django urls.py file, and not have to update all of the scripts.

How do I know this?

When the user told me he got Uncaught ReferenceError: discardDraft is not defined, then I realized that his computer was not loading scripts inside of templates. I tested this by first adding a basic alert in the template file, and nothing appeared. I then tried adding another alert inside of the scripts file, and voila it works.

So I am extremely puzzled and honestly have no clue how to figure out a solution to this.

Other issues this user faced:

make-corrections.js:96 Uncaught ReferenceError: discardDraft is not defined
    at HTMLButtonElement.<anonymous> (make-corrections.js:96)
    at HTMLButtonElement.dispatch (VM201 jquery-3.5.1.min.js:2)
    at HTMLButtonElement.v.handle (VM201 jquery-3.5.1.min.js:2)
    at HTMLButtonElement.c (rocket-loader.min.js:1)

I tried disabling rocket-loader and turned dev mode on cloudflare, but no dice.

This issue seems to be affecting just this particular user and no one else. They tried two different browsers (Opera and Chrome), Incognito/Private browsing, and with cache disabled checked. All addons were also disabled.

Any ideas what it could be?

Edit:

template:


<body>

<script type="application/javascript" src="{% static 'js/jquery-3.5.1.min.js' %}"></script>

<script>
   code here
</script>

</body>

Edit2: Do I need to add type="application/javascript" for it to work for this user?

about 4 years ago · Juan Pablo Isaza
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