diff --git a/plugins/tiddlywiki/share/rawmarkup.js b/plugins/tiddlywiki/share/rawmarkup.js index c0ab77659..264f7fc73 100644 --- a/plugins/tiddlywiki/share/rawmarkup.js +++ b/plugins/tiddlywiki/share/rawmarkup.js @@ -13,19 +13,17 @@ Read tiddlers from the browser location hash "use strict"; // Get the hash -var rawHash = document.location.hash.substring(1); -if(rawHash.charAt(0) === "#") { - var hash; - try{ - hash = decodeURIComponent(rawHash.substring(1)); - } catch(ex) { - console.log("Share plugin: Error decoding location hash",ex); - } +var hash; +try { + hash = decodeURIComponent(document.location.hash.substring(1)); +} catch(e) { +} +if(hash && hash.charAt(0) === "#") { // Try to parse the hash as JSON if(hash) { var tiddlers; try { - tiddlers= JSON.parse(hash); + tiddlers= JSON.parse(hash.substr(1)); } catch(ex) { console.log("Share plugin: Error parsing JSON from location hash",ex); }