I use window.history.replaceState () to change the query string of the HTML file that was accessed using the file: /// C: / ...
This worked in Chrome, Internet Explorer and FireFox, but no longer works in Chrome. Not sure when it stops working. I have Chrome 45.0.2454.85. It still works in other browsers.
I get:
Uncaught SecurityError: Failed to execute 'replaceState' in 'History': History state object with URL 'file: /// C: /Users/Michael/Desktop/test.html? Q = NewQueryString 'cannot be created in a document with the original value "null".
Sorry, but this does not work in any hosting. You can copy the code to a local HTML file to see it for yourself:
<html> <body> <button onclick="clickme()">Click me</button> <script> function clickme() { window.history.replaceState({ "html": undefined, "pageTitle": "NewTitle"}, "", "?Q=NewQueryString"); } </script> </body> </html>
Obviously, I could host this on the server, but tried to stay simple. This is a simple scripting board that we use as Git. He uses a third-party web service to retrieve data. Any ideas for working with the error.
javascript google-chrome
Mike
source share