9

With Gmail's recent change to serve all images through a proxy, it appears that it is no longer possible to embed an image that is served up via a localhost URL. For example, as a developer, I used to be able to send an email to myself with content like:

<img src="http://localhost/trackthismessage?readby=xxxx" />

and, upon telling Gmail to display images, the image would be served up by my local development machine.

Now, with the proxy in the middle, it seems this is no longer possible. Is this functionality now just gone or is there a workaround?

1
  • Highly doubt that there will be a workaround, unless gmail goes back on this feature. You probably need to make your image available from the internet so that gmail can cache it.
    – Munim
    Dec 24, 2013 at 5:16

2 Answers 2

5

There is actually a workaround for developing. Just run this in your JS console and the images will appear. Found this on Stack Overflow. Make sure you choose 'Display Images' on the message first

(function(){ while(img = document.evaluate('//img[contains(@src, \'googleusercontent.com\')]', document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue){ var src = img.attributes.src.value; src = src.substr(src.indexOf('#')+1); img.attributes.src.value = src; } })();

You can also create a bookmark for increased handiness prefixing the above with javascript:

javascript:(function(){ while(img = document.evaluate('//img[contains(@src, \'googleusercontent.com\')]', document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue){ var src = img.attributes.src.value; src = src.substr(src.indexOf('#')+1); img.attributes.src.value = src; } })();
0

As already mentioned by you in the question itself and also by Munim in the comments, it is highly unlikely for this possible anytime soon in the near future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.