0

I wanted to know how to import a javascript file from a source like pastebin.com/raw or dl.dropboxusercontent.com into a javascript file. I'm talking about a solution similar to the @import ""; in CSS.

I'm not trying to interfere the HTML in anyway (e.g.)

<script src="http://pastebin.com/raw/xxxxxx">
Recuvan
  • 161
  • 5
  • 1
    Possible duplicate of [Include a JavaScript file in another JavaScript file?](http://stackoverflow.com/questions/950087/include-a-javascript-file-in-another-javascript-file) – Daniel Beck Apr 29 '16 at 17:54

1 Answers1

0
 var firstScript = document.getElementsByTagName('script')[0],
 js = document.createElement('script');
 js.src = 'https://pastebin.com/raw/xxxxx';
 firstScript.parentNode.insertBefore(js, firstScript);
Recuvan
  • 161
  • 5