to your webpage, then using a script tag
and above request is loading this code snippet https://js.monkcommerce.app/mr.js
<script src="https://js.monkcommerce.app/mr.js"></script>
I know how it will work I am asking where to generate that url? should I host it somewhere?
Whenever the browser parses your HTML page, and sees this script tag, It'll see if it has a src attribute, and if there's one: I'll do a request to that "URL". if everything goes fine (the contents at the URL were successfully retrieved), then the browser executes the JavaScript
This is a very simplified explanation, the browser is doing other things, but at a higher level, that's what's happening
but where is this hosted https://js.monkcommerce.app/mr.js ??? on any server?
No, it's in some other server on the internet
how can I generate one for my self? I have some JS code but want to host it on server and then use it on another website how can I do that?
Put the Javascript file in the same place as your HTML pages, or even better, put it inside a directory called js, then you'll end up with something like this: - index.html - js/ - app.js Finally add a script tag and give it a src attribute pointing to app.js
If you are making a browser library you can just put it in npm
Обсуждают сегодня