How to add external scripts?

  • I tried loading it like this:

    mounted() {
        var script = document.createElement("script");
        script.src = "";
        script.type = "text/javascript";
        var head = document.getElementsByTagName("head")[0];

    but that doesn’t work - it doesn’t load.

    (I used the html from here except for the script tag.)

    I also tried it with “vue-twitter” (like it and with a boot-file) which uses VueScript2.load but it says: "TypeError: window.twttr is undefined" so it doesn’t properly load that script.

    I could be overlooking something trivial here. NoScript shows a request to twitter, I hope it’s not a CORS issue - I’m testing with quasar dev and Firefox and would expect a CORS-related error message if it was.

    How to load external (libraries/)scripts?