From c38841c5af666f1cf87c943cb2f308c4c244ac37 Mon Sep 17 00:00:00 2001 From: Logan Tegman Date: Wed, 4 Nov 2015 11:04:54 -0800 Subject: [PATCH] Fix Code Editor Changes Creating Duplicate History Entries Closes #4167 --- client/commonFramework.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/commonFramework.js b/client/commonFramework.js index 20ba4b40e1..ef3427928c 100644 --- a/client/commonFramework.js +++ b/client/commonFramework.js @@ -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; },