Posts Tagged ‘internet explorer’

Preventing Internet Explorer from using Compatibility View

Wednesday, August 15th, 2012

I’ve had some trouble with Internet Explorer recently.

I was making a new web tool which looked fine in all browsers. Except Internet Explorer, where it looked a bit squiffy.

Internet Explorer has “Compatibility View”. Compatibility View makes IE behave like the older versions of Internet Explorer, the ones before Microsoft started paying more attention to web standards.

It makes sense – there are a lot of websites out there that were written to render well on old versions of Internet Explorer, and Microsoft needed to make the move to standards compliance in a way that doesn’t break all of them.

The problem is, Compatibility View can be a little… insistent.

It kept turning on, even though I didn’t want it, even though my site worked fine in new shiny standards mode, and looked horribly broken in Compatibility View.

You can manually disable it, but I don’t want to have to make users do that. As the web developer, I want to be able to disable it – to tell IE that I want the site to be rendered in standards mode.

It was a bit fiddly. Here’s how I did it.


Programmatically getting last visited page from Pocket Internet Explorer

Tuesday, February 17th, 2009

I wrote earlier about my hack for syncing my browsing between my computer and mobile.

One of the most fiddly bits of implementing this was how to get the last visited page from Pocket Internet Explorer on my phone. In case this is useful to anyone, here is a quick description of how I did it.

I wrote the code to get the last visited page in C++. I couldn’t find any way to access the browser, or the address bar, programmatically.

The closest I could find is a set of Windows Internet Services API calls which let you have direct access to the browser cache used by Pocket Internet Explorer.

I wrote the code for Pocket Internet Explorer on Windows Mobile, but to the best of my knowledge it should work on regular Internet Explorer. I’ve not tried it because, let’s be honest, who uses Internet Explorer? 😉

The approach was to use FindFirstUrlCacheEntryEx and FindNextUrlCacheEntryEx to enumerate through the INTERNET_CACHE_ENTRY_INFO entries in the Internet cache.

Each INTERNET_CACHE_ENTRY_INFO item stores (amongst other information) the URL it was downloaded from, and the time the cache item was last accessed.

So I find the last page the user has visited by enumerating through the cache, and store the URL for the cache item with the latest last-accessed time.