diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js
index 10970a7749..d4937ac9db 100644
--- a/scripts/system/html/js/marketplacesInject.js
+++ b/scripts/system/html/js/marketplacesInject.js
@@ -26,6 +26,8 @@
var xmlHttpRequest = null;
var isPreparing = false; // Explicitly track download request status.
+ var lastPage = "https://metaverse.highfidelity.com/marketplace?";
+
function injectCommonCode(isDirectoryPage) {
// Supporting styles from marketplaces.css.
@@ -65,7 +67,7 @@
// Footer actions.
$("#back-button").on("click", function () {
- window.history.back();
+ window.location = lastPage;
});
$("#all-markets").on("click", function () {
EventBridge.emitWebEvent(GOTO_DIRECTORY);
@@ -342,7 +344,12 @@
}
}
+ function locationChanged() {
+ lastPage = location.href;
+ }
+
// Load / unload.
window.addEventListener("load", onLoad); // More robust to Web site issues than using $(document).ready().
+ window.addEventListener("hashchange", locationChanged);
}());
diff --git a/scripts/system/tablet-users.js b/scripts/system/tablet-users.js
index d5c381917e..a74b7f2910 100644
--- a/scripts/system/tablet-users.js
+++ b/scripts/system/tablet-users.js
@@ -69,7 +69,11 @@
function onWebEventReceived(event) {
print("Script received a web event, its type is " + typeof event);
if (typeof event === "string") {
- event = JSON.parse(event);
+ try {
+ event = JSON.parse(event);
+ } catch(e) {
+ return;
+ }
}
if (event.type === "ready") {
// send username to html