Alright, I've coded my own CMS that's using jquery, php, .htaccess redirecting to one index.php behind the curtains, and HTML5 History API. Now I encountered weirdest bug I've ever seen.
On my computer, and on my android phone, and on most the devices I try, everything works flawlessly.
But then, on one of my friends computer AND iPhone, whatever browser I use, even the same newest chrome that I use myself, Dom Exception 18 happens (in javascript console), and stops all the ajax code from executing, breaking the CMS.
The error points to this row:
History.replaceState({location:href}, "", href);
Just a regular history.js statement that works flawlessly with my browsers. I actually used normal html5 history API but changed it to history.js implementation to see if it helped, it didn't. If I remove the initial replaceState, the error happens when I click any link, so it's the first history push event that's triggering the Dom error.
I've tried to search for Dom Exception 18, but all the answers seem to relate to specific packages or manipulating images from different hosts.
You can see for yourself if it works for you in www.roopesalminenjakoirat.fi. Dom Exception 18 should appear in the inspector immediately, if it happens. It doesn't break the page because I don't use ajax when logged out, but please report if you see the error.
Please help!
found it! Apparently it's got to do with base-element either having "www" or not. Currently I have just <base href="http://roopesalminenjakoirat.fi" />
, so the problem didn't occur to me before because I usually don't type www, but occurred to my friend because he writes the www!
So the answer is to match the base-element www-part with whether the user has typed it or not, otherwise replaceState throws a security error!