HTML - Third Party Script

> (World Wide) Web - (W3|WWW) > HyperText markup Language (HTML)

1 - About

Third Party Script are script that have been created by third party.

Example:

  • Google adsense
  • Google Analytics
Advertising

3 - Management

3.1 - Loading

Third party script

Example loading asynchronously Facebook library

(function (d, s, id) {
    var js;
    // Get the first script element
    var fjs = d.getElementsByTagName(s)[0];
    // if the element already exist with the id. do nothing
    if (d.getElementById(id)) {
        return;
    }
    // Create a script element
    js = d.createElement(s);
    js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js";
    // get the parent node (the head normally) and insert it before the first one
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

3.2 - Security

Content-Security-Policy: script-src https://example.com/
  • The following third-party script will not be loaded or executed
<script src="https://not-example.com/js/library.js"></script>
web/html/third_party_script.txt · Last modified: 2019/04/17 19:33 by gerardnico