Newbie Newbie -4 years ago 110
HTML Question

How to include External Script using console?

I want to know ,
How to include External JavaScript into current page using developer console.

I am having static plain html/js i want to test it with several js libraries as well as css in it. without adding in

.html
file or i am from remote machine.

so how do achieve it using Developer console?

Answer Source

You can try this to inject your script into HTML DOM

inject = document.createElement('script');
inject.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(inject);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download