History pushState issues

December 6th, 2011

Opera 11.60 broke navigation on our main website. It does not longer because I added a workaround.

It’s all related to setting the baseURI (wrongly) after ajax loading and history.pushState

To see the problem:

Open this page in Opera 11.60:

  1. http://www.webonomic.nl
  2. Click internet
  3. Inspect any element and readout the baseURI property, it’s set to

http://www.webonomic.nl/webdesign/internet

While Opera 11.52, Firefox and Chromium set it to

http://www.webonomic.nl/

according to the base href element of original the document.

I looked up the specs:

http://www.w3.org/TR/html5/webappapis.html#script-s-base-url

A base URL

A URL, set when the script is created, used to resolve relative URLs. If the base URL is set from another source, e.g. a document base URL, then the script’s base URL must follow the source, so that if the source’s changes, so does the script’s.

I’m not sure if a pushState is changing the source, I can imagine it does, so Opera’s 11.6 behaviour does make sense somewhere. On the other hand it doesn’t change the source of the script?

A couple of questions raise:

  • Is Opera’s 11.60/12.00 new behaviour a bug?
  • How do we set the base url of a json document?
  • How do I set the base URL for a script?

To me Opera 11.5, Firefox, and Chromium’s behaviour does make sense by keeping the base URI of elements to the href attribute of the base element after a pushState event.

Can anyone shed some light?

(I decided to ask this question on the Opera Dev forum as well )

Leave a Reply