Skip to content

Instantly share code, notes, and snippets.

@davestevens
Created September 3, 2015 14:53
Show Gist options
  • Save davestevens/d30a9dee975ba03eab55 to your computer and use it in GitHub Desktop.
Save davestevens/d30a9dee975ba03eab55 to your computer and use it in GitHub Desktop.
replaceState test
<!--
Opening this in the latest Chrome (Version 45.0.2454.85) results in an error
"Uncaught SecurityError: Failed to execute 'replaceState' on 'History'"
This has only just stated happening this afternoon and doesn't cause an issue on older versions of Chrome
-->
<!DOCTYPE html>
<html>
<head>
<title>Testing replaceState</title>
</head>
<body>
<h1>Testing replaceState</h1>
<p id="error-display">No errors</p>
<script>
var error_display = document.getElementById("error-display");
window.onerror = function(message, _url, _line_number) {
error_display.textContent = message;
return true;
};
window.history.replaceState({}, '', '#test');
</script>
</body>
</html>
@davestevens
Copy link
Author

Opening this in the latest Chrome (Version 45.0.2454.85) results in an error:

Uncaught SecurityError: Failed to execute 'replaceState' on 'History': A history state object with URL 'file:///replaceState.html#test' cannot be created in a document with origin 'null'.

This has only just stated happening this afternoon and doesn't cause an issue on older versions of Chrome.

Running this on a server causes no issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment