hashchange: Add warning if pushState is not available.

This commit is contained in:
Steve Howell
2018-12-06 21:59:05 +00:00
committed by Tim Abbott
parent 0914037bed
commit 7cbf031f18
2 changed files with 4 additions and 0 deletions

View File

@@ -303,7 +303,10 @@ run_test('save_narrow', () => {
{operator: 'is', operand: 'private'}, {operator: 'is', operand: 'private'},
]; ];
blueslip.set_test_data('warn', 'browser does not support pushState');
hashchange.save_narrow(operators); hashchange.save_narrow(operators);
blueslip.clear_test_data();
helper.assert_events([ helper.assert_events([
'message_viewport.stop_auto_scrolling', 'message_viewport.stop_auto_scrolling',
'favicon.reset', 'favicon.reset',

View File

@@ -31,6 +31,7 @@ function set_hash(hash) {
var url = get_full_url(hash); var url = get_full_url(hash);
history.pushState(null, null, url); history.pushState(null, null, url);
} else { } else {
blueslip.warn('browser does not support pushState');
window.location.hash = hash; window.location.hash = hash;
} }
} }