I have this JavaScript file URL:
https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js
(hosted on GitHub and passed through RawGit), and I would like to inject it into a live web page via the browser’s console.
In order to achieve that, I can dynamically create a <script>
element and append 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 this is neither quick nor easy. I would like to use an API that makes this possible via a simple invocation, e.g.:
exec('https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js')
Do Chrome or Firefox provide such an API (or anything similar) in their console?
Use case: Quickly testing JavaScript libraries hosted on GitHub on live web pages.
Update: The Developer Toolbar has been removed from Firefox Nightly as of 18th May 2018.
In Firefox, you can inject scripts using the Developer Toolbar. Bring it up withShift+F2
and type inject https://rawgit.com/Khan/tota11y/master/build/tota11y.min.js
More info on MDN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With