What is the fastest and easiest way to execute a javascript file on a live webpage?

I have this javascript url:

https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js

(hosted on GitHub and went through RawGit), and I would like to add it to a live web page through the browser console.

To achieve this, I can dynamically create an element <script>and add it to the DOM:

(function () {
  var s = document.createElement('script');
  s.src = 'https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js';
  document.body.appendChild(s);
}())

But it is not fast and easy. I would like to use an API that makes this possible with a simple call, for example:

exec('https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js')

Do Chrome or Firefox provide such an API (or something similar) in the console?


Use case: Quickly test JavaScript libraries hosted on GitHub on live web pages.

+4
3

Firefox . Shift+F2 inject https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js

MDN

+9

, . :

. , , , . JavaScript , .

0

All Articles