<scripttype="module"> // will not block the button console.log(this) // undefined console.log(import.meta.url) // the url of import file </script> <script> // will block the button console.log(this) // window </script>
<scriptasynctype="module"src="http://example.com/test.js"> // will run immediate when the file is load // example.com needs the Access-Control-Allow-Origin flag import {sayHi} from'sayHi'// this will get error because no path import in this module block. </script>
<scriptnomodule> alert("The Browser can not support the module import.") </script> </head> <body> <button>Button</button> </body> </html>