IE BHO: Including local images in a remote page…

I’ve been writing an IE plugin (or BHO) and ran across a problem when I tested it under IE 7.  When I included images off of the local harddrive, most didn’t show up under IE7 (but worked fine under IE 6).  However, I noticed that one image I was using did work.

The difference was that this image was a CSS style background.  So I was able to work around this problem by simply converting all of my images to be spans/divs with the style.backgroundImage=”url(‘path to local image file‘)”.

Of course the caveat is that this behavior is probably not something they intended, and may fix it at some point.  But until then, it’s an easy change (compared to using the res protocol or a custom protocol – mentioned in the BhoWiki ) to get the job done.  Also, I’ve heard that the IE7 is slightly different under Vista as compared to XP.  I have been testing IE 7 under XP using the Microsoft Virtual PC testing images they have freely available for download (Info about it here and download page actually has XP with IE6 (if you have upgraded to IE7 already) and XP with IE7 (in case you still are running IE6 or Vista).  The article links to an older version of Microsoft Virtual PC, but you can use the latest one here (I’ve noticed it fixed some issues I saw under the old version).

UPDATE: 4/7/2010 Forgot to post this back here till now, but IE8 seems to have closed this hole.  I’ve given up on locally serving them and now host them on my website.  There was something I had read about possibly creating the images as resources in a DLL (like the images in the about:tabs page – something like res://ieframe.dll/tab_icon.png .)   I’ve not tried it, so this approach may not work due to security zone restrictions.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: