Skip to content

Commit

Permalink
fix(js): make sure elgg.forward() always reloads the page
Browse files Browse the repository at this point in the history
If the destination URL has a hash, and the whole URL is identical
to the current page, we must force `reload()`.
  • Loading branch information
mrclay committed Feb 17, 2017
1 parent 0ace278 commit c42b9c9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion js/lib/elgglib.js
Expand Up @@ -423,7 +423,19 @@ elgg.deprecated_notice = function(msg, dep_version) {
* @param {String} url The url to forward to
*/
elgg.forward = function(url) {
location.href = elgg.normalize_url(url);
var dest = elgg.normalize_url(url);

if (dest == location.href) {
location.reload();
}

// in case the href set below just changes the hash, we want to reload. There's sadly
// no way to force a reload and set a different hash at the same time.
$(window).on('hashchange', function () {
location.reload();
});

location.href = dest;
};

/**
Expand Down

0 comments on commit c42b9c9

Please sign in to comment.