Tutorial :google charts url works in img tag but not in browser location bar


I'm using django-googlecharts to generate a simple pie chart. Inside the img tag, it works just fine, but if I paste the img src in the location bar of the browser, google returns "Bad Request", "Your client has issued a malformed or illegal request".

I followed the example in the django-googlecharts documentation here:


and actually, these examples from the documentation have the same problem. So, for example:

<img src="http://chart.apis.google.com/chart?chs=300x200&amp;cht=p&amp;chl=One|Two|Three&amp;chd=e:VVqq.." width="300" height="200" alt="It worked!" />  

works fine in the web page, but the src cut and pasted into the browser location bar does not:


I don't know if this is an encoding problem or something else. I've been trying to embed these charts in an HTML email without luck, and I'm wondering if figuring this part out will lead to solution. Thanks for your help!


The browser interprets the escaped ampersands &amp; into real ampersands & when used in an image tag, but not when directly put into the address bar.

The url http://chart.apis.google.com/chart?chs=300x200&cht=p&chl=One|Two|Three&chd=e:VVqq.. works just fine in the browser.


You've got HTML entities in the URL. Just use an HTML entity decoder:


That's the HTML entity decoded version of the URL that you have above. Just run it through the decoder I've linked.

Hope this helps!

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »