Thursday, March 3, 2011

Unstoppable META Re-direct

A frustrating day was spent yesterday trying to stop a page with a META tag (like the one show in the code below) from redirecting the Chrome browser to another location.

<meta equiv="Refresh" content="10; url=http://www.test.com">

With regard to Project metalmouth, the reasons for trying to stop the auto-redirect relate directly to user experience. What if a user is starting to listen to a page being read out, only to have the experience terminate abruptly and the same or another page start to be read out instead? If it were me I think I would be annoyed...

Unfortunately I have to report that all my efforts were in vain.

Apparently the redirect count-down starts as soon as the META element appears in the page, so removing it from the DOM or resetting its attribute values after page load does nothing.

I tried to inject an anonymous function to try and alter the contents of the HEAD element as the code loaded but to no useful effect. Injecting document.documentElement.firstChild.innerHTML = "" via an anonymous function in the page does have an effect - the redirect is stopped as two empty head elements appear and two body elements (one empty) - however, although this is interesting, it was not so useful as the page is effectively destroyed.

I went on to look at the possibility of providing a warning that the page was going to redirect... But, with regard to user experience I came to the conclusion that this would be just as bad - with the reasonable question "if the Project metalmouth extension knows the page is going to redirect why can't it prevent it?"

So, in the end I decided that the best possible solution for everyone might be if a user could elect to permanently stop all refreshes / redirects (via META elements) via a setting in the Chrome browser. With a bit more research, this apparently seems to be the approach other main stream browsers have adopted as well.

To this end I have added a post to an existing request for this functionality to the Chromium Project (http://code.google.com/p/chromium/issues/detail?id=63107) - so, let's keep our fingers crossed.

As always, if you are using the extension or just like the intensions behind the project (I already like you and think your wonderful) I would ask you to get involved in the project (especially user testing, feature requests, etc...) - otherwise, maybe just providing a link to the project website (http://code.google.com/p/metalmouth/) so that others may more easily find it.

No comments:

Post a Comment