Merge pull request #4168 from ltegman/fix/code-editor-spamming-browser-history-4167

Fix Code Editor Changes Creating Duplicate History Entries
This commit is contained in:
Berkeley Martinez
2015-11-05 17:28:13 -08:00

View File

@@ -136,8 +136,16 @@ common.codeUri = (function(common, encode, decode, location, history) {
if (!codeUri.enabled) {
return null;
}
location.hash = '?solution=' +
codeUri.encode(encodeFcc(solution));
if (history && typeof history.replaceState === 'function') {
history.replaceState(
history.state,
null,
'?solution=' + codeUri.encode(encodeFcc(solution))
);
} else {
location.hash = '?solution=' +
codeUri.encode(encodeFcc(solution));
}
return solution;
},