Pocket IE and Setting IMG Src via JavaScript

By Jay at September 07, 2008 09:28 Tags:

Cet article est disponible en francais ici.

With the Montreal's Bus Stop Locator web site, to be able to use Google Maps effectively, it's imperative to let the client's browser fetch the image by itself. The Google API does not allow a single key to grab a lot of maps from a single host, so redirecting the image is not an option.

I wanted to have the image Url generated so I could use the Width of an HTML body to be embedded in the Map query, so I created a small script that builds the URL and sets as the SRC of the IMG element that will contain the Map.

Well, that seems easy, but it's not... The IMG does fetch the image, but the element's size is not updated with the size of the new image.

In my case, I'm placing the image in a TABLE element, so I'm getting the default cell size for my image. To fix that I also had to set the width and height of the IMG element, to get it to have a proper size.

PocketIE has little support for scripting, but it's somehow clear that it has been a hard to fit addition to the engine... Come on microsoft ! You can do better than that ! Have a look at what Opera's been doing...

blog comments powered by Disqus

About me

My name is Jerome Laban, I am a Software Architect, C# MVP and .NET enthustiast from Montréal, QC. You will find my blog on this site, where I'm adding my thoughts on current events, or the things I'm working on, such as the Remote Control for Windows Phone.