diff --git a/js/BoxPage.js b/js/BoxPage.js index 467db7d..021c591 100644 --- a/js/BoxPage.js +++ b/js/BoxPage.js @@ -44,6 +44,10 @@ $.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) { console.log("Box page pagebeforeshow"); _boxData = d3d.util.getPageParams(PAGE_ID); + if(_boxData === undefined) { + $.mobile.changePage("#boxes"); + return; + } var boxURL = "http://"+_boxData.localip; //console.log(" _boxData: ",_boxData); diff --git a/js/ConnectingToNetworkPage.js b/js/ConnectingToNetworkPage.js index 123b3f1..14bfa6a 100644 --- a/js/ConnectingToNetworkPage.js +++ b/js/ConnectingToNetworkPage.js @@ -38,6 +38,10 @@ $.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) { console.log("Connecting to network page pagebeforeshow"); _pageData = d3d.util.getPageParams(PAGE_ID); + if(_pageData === undefined) { + $.mobile.changePage("#boxes"); + return; + } var boxURL = "http://"+_pageData.localip; var form = data.prevPage.find("form"); diff --git a/js/JoinNetworkPage.js b/js/JoinNetworkPage.js index ef51dea..c250aca 100644 --- a/js/JoinNetworkPage.js +++ b/js/JoinNetworkPage.js @@ -29,6 +29,10 @@ $.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) { console.log("Join network page pagebeforeshow"); _boxData = d3d.util.getPageParams(PAGE_ID); + if(_boxData === undefined) { + $.mobile.changePage("#boxes"); + return; + } var boxURL = "http://"+_boxData.localip; console.log(" _boxData: ",_boxData); diff --git a/js/JoinSecuredNetworkPage.js b/js/JoinSecuredNetworkPage.js index dd63490..ad0412d 100644 --- a/js/JoinSecuredNetworkPage.js +++ b/js/JoinSecuredNetworkPage.js @@ -34,6 +34,10 @@ $.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) { console.log(PAGE_ID+" pagebeforeshow"); _pageData = d3d.util.getPageParams(PAGE_ID); + if(_pageData === undefined) { + $.mobile.changePage("#boxes"); + return; + } console.log(" _pageData: ",_pageData); _title.text("Join "+_pageData.ssid); _form.attr("id","Join "+_pageData.ssid); diff --git a/js/main.js b/js/main.js index 3171065..62b3d36 100644 --- a/js/main.js +++ b/js/main.js @@ -105,11 +105,11 @@ d3d.util = { // To get to url parameters we need the url // only pagecontainer events contain url's // we parse the parameters and store them in a global object + d3d.pageParams = {}; $.mobile.document.on( "pagebeforechange", function( event, data ) { if (typeof data.toPage !== "string") { return; } var url = d3d.util.parseURL(data.toPage); if(url.parameters === undefined) { return; } - if(!d3d.pageParams) { d3d.pageParams = {}; } d3d.pageParams[url.hash] = url.parameters; // let jQuery mobile navigate to page (providing only the page id so it understands)