Site current URI can now be easily updated.

This commit is contained in:
Pierre 2018-05-15 21:32:02 +02:00
parent 1f636b7a5f
commit 73dfc842af
2 changed files with 21 additions and 4 deletions

View File

@ -191,6 +191,11 @@ var ComunicWeb = {
*/ */
refresh_current_page: function(){}, refresh_current_page: function(){},
/**
* Safely trigger URL update
*/
update_uri: function(title, uri){},
/** /**
* Inform of page location update * Inform of page location update
*/ */

View File

@ -188,10 +188,7 @@ ComunicWeb.common.page = {
//Change page URL, if required //Change page URL, if required
if(additionnalData.no_url_update ? !additionnalData.no_url_update : true) if(additionnalData.no_url_update ? !additionnalData.no_url_update : true)
ComunicWeb.common.url.changeURI(document.title, pageURI); this.update_uri(document.title, pageURI);
//Save new url
this._current_url = window.location.href.toString();
//Get the main container of the page //Get the main container of the page
var mainContainerElem = byId("wrapper"); var mainContainerElem = byId("wrapper");
@ -278,6 +275,21 @@ ComunicWeb.common.page = {
this.openPage(currentPage, {no_url_update: true}); this.openPage(currentPage, {no_url_update: true});
}, },
/**
* Safely trigger URL update
*
* @param {String} title The new title of the page
* @param {String} uri The new URL
*/
update_uri: function(title, uri){
//Trigger URL update
ComunicWeb.common.url.changeURI(title, uri);
//Save new url
this._current_url = window.location.href.toString();
},
/** /**
* Inform of page location update * Inform of page location update
* *