diff --git a/js/src/functions.js b/js/src/functions.js index 28c1d214a5..1654f17121 100644 --- a/js/src/functions.js +++ b/js/src/functions.js @@ -3806,14 +3806,22 @@ AJAX.registerOnload('functions.js', function () { // Sync favorite tables from localStorage to pmadb. if ($('#sync_favorite_tables').length) { + var favoriteTables = ''; + if (isStorageSupported('localStorage') + && typeof window.localStorage.favoriteTables !== 'undefined' + && window.localStorage.favoriteTables !== 'undefined') { + favoriteTables = window.localStorage.favoriteTables; + if (favoriteTables === 'undefined') { + // Do not send an invalid value + return; + } + } $.ajax({ url: $('#sync_favorite_tables').attr('href'), cache: false, type: 'POST', data: { - 'favoriteTables': (isStorageSupported('localStorage') && typeof window.localStorage.favoriteTables !== 'undefined') - ? window.localStorage.favoriteTables - : '', + 'favoriteTables': favoriteTables, 'server': CommonParams.get('server'), 'no_debug': true },