110
Views
4
Comments
How can I use the type="module" in a script? (Mobile)
 <script type="module" src="-------------"></script>

Hey, so, I need to use a script, but I need it's type to be a "module" instead of a regular script, how can I achieve this? Bare in mind I'm on mobile


I imported the script and I'm using it on the screen, using F12 I can see it is consuming the screen, just doesn't have the type I need.



2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi Fábio,

What is a script of type module?

Why does the type need to be "module", actually to include a javascript file type attribute is not at all required for many years.

Regards,

Daniel

2019-12-01 23-50-25
Pedro Neto
Champion

I stumbled upon this and it seems it is required in some cases where the script should be treated as a javascript module: 

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

UserImage.jpg
Catarina Ferreira

Pedro did you manage to find how to solve this?

2018-07-06 11-13-55
Nathan Hobbs

Did anyone ever get an answer?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.