Skip to content

Instantly share code, notes, and snippets.

@samber
Last active January 22, 2021 17:05
Show Gist options
  • Save samber/a7b508ee8b11747def1a99b9eeb5169d to your computer and use it in GitHub Desktop.
Save samber/a7b508ee8b11747def1a99b9eeb5169d to your computer and use it in GitHub Desktop.
Inject JS into web page

How-to

Using the Chrome developer console

Just copy paste into the console:

(function(){
  s=document.createElement('script');
  s.type='text/javascript';
  s.src='http://localhost:2020';
  document.body.appendChild(s);
})();

Using a browser bookmarklet

Add a bookmark with the following URL:

javascript:(function(){s=document.createElement('script');s.type='text/javascript';s.src='http://localhost:2020';document.body.appendChild(s);})();
@samber
Copy link
Author

samber commented Jan 22, 2021

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment