Fix error when browser doesn't know how to deal with window.navigator.registerProtocolHandler

This commit is contained in:
Étienne Deparis 2014-10-21 00:33:14 +02:00
parent 46fc58f69e
commit 4efada7fd8

View File

@ -377,8 +377,10 @@ function watchHashChange(e)
function initHashWatching()
{
// Register custom protocol handler
var local_twister_url = window.location.protocol + '//' + window.location.host + '/home.html#%s';
window.navigator.registerProtocolHandler('web+twister', local_twister_url, 'Twister');
if (window.navigator && window.navigator.registerProtocolHandler){
var local_twister_url = window.location.protocol + '//' + window.location.host + '/home.html#%s';
window.navigator.registerProtocolHandler('web+twister', local_twister_url, 'Twister');
}
// Register hash spy and launch it once
window.addEventListener('hashchange', watchHashChange, false);