- Most resources start loading when they are added to the document. But
<img>is an exception. It starts loading when it gets a src(*). - For
<iframe>, theiframe.onloadevent triggers when the iframe loading finished, both for successful load and in case of an error.
Crossorigin policy
To allow cross-origin access, the <script> tag needs to have the crossorigin attribute, plus the remote server must provide special headers.
There are three levels of cross-origin access:
- No
crossoriginattribute – access prohibited. crossorigin="anonymous"– access allowed if the server responds with the headerAccess-Control-Allow-Originwith*or our origin. Browser does not send authorization information and cookies to remote server.crossorigin="use-credentials"– access allowed if the server sends back the headerAccess-Control-Allow-Originwith our origin andAccess-Control-Allow-Credentials: true. Browser sends authorization information and cookies to remote server.
