Skip to content

Instantly share code, notes, and snippets.

@BeerOnBeard
Last active April 25, 2021 14:12
Show Gist options
  • Save BeerOnBeard/bbaaf266593e422f4fbf509aa719bd87 to your computer and use it in GitHub Desktop.
Save BeerOnBeard/bbaaf266593e422f4fbf509aa719bd87 to your computer and use it in GitHub Desktop.
Bookmarklet to remove the proxy GMail uses to display images in img tags. It enables me to test content in emails from sites not exposed to wide Internet.
/*
* GMail's image proxy gets in the way when testing emails that are coming from testing websites that we do not expose
* to the general internet. This bookmarklet code will remove the proxy in the URI of all HTML img tags on the current
* page and update the src attribute with the non-proxy version of the content URI. All src tags that do not use the
* Google User Content proxy service will be left alone. To use this, copy the code into the URL field of a new bookmark
* in your browser. Then, when looking at an email that has images provided by the proxy, click the bookmark and the
* images should appear.
*/
javascript:(function() {
var images = document.getElementsByTagName('img');
for (var i = 0; i < images.length; i++) {
var hashIndex = images[i].src.indexOf('#');
images[i].src = images[i].src.substring(hashIndex + 1);
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment