Asked 8 years ago
7 Nov 2016
Views 885
jabber

jabber posted

add .js file at web page by javascript

i want to add js file to web page without use of <script>


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>


so it will be done by javascript and should be lately . so let me know if you have code for it .
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

almost all website have this code which is used by google
i modified little bit to make it as per your need



 (function() {
    var ga = document.createElement('script');
   ga.type = 'text/javascript'; ga.async = true;
    ga.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'; 
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

hope it work !!
yes you are right ,my web page also this code but did not recognize i can use it like this .Thanks - jabber  
Nov 7 '16 04:00
Post Answer