mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
38 lines
1.4 KiB
HTML
38 lines
1.4 KiB
HTML
<html>
|
|
<head>
|
|
<title>Chrome History API Data Artifact</title>
|
|
</head>
|
|
<body>
|
|
<p>This demo demonstrates an issue with Google Chrome versions 8-10 (possibly 11) where if you push a state with data, then do history.back to the initial state, the event.state will contain the pushed states data instead of being null.</p>
|
|
<p>Note: The issue requires a clean history list, as such this should always be opened in a new tab/window where there are no prior history items.</p>
|
|
<p>Reported by <a href="http://balupton.com">Benjamin Lupton</a> author of <a href="http://github.com/balupton/history.js">History.js</a></p>
|
|
<button id="bug">bug</button>
|
|
<button id="reset">reset</button>
|
|
<textarea id="log" style="width:100%;height:200px;margin-top:1em;"></textarea>
|
|
<script type="text/javascript">
|
|
(function(){
|
|
|
|
window.onpopstate = function(event) {
|
|
var message = ("onpopstate: location: " + document.location.href + ", data: " + JSON.stringify(event.state));
|
|
document.getElementById('log').innerHTML += message+"\n\n";
|
|
};
|
|
|
|
document.getElementById('bug').onclick = function(){
|
|
setTimeout(function(){
|
|
history.pushState({state:'new'},'New State','?new');
|
|
},1e3);
|
|
|
|
setTimeout(function(){
|
|
history.back();
|
|
},2e3);
|
|
};
|
|
|
|
document.getElementById('reset').onclick = function(){
|
|
document.location.href = document.location.href.replace(/[\#\?].*/,"");
|
|
};
|
|
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|