From: Florent Bruneau Date: Tue, 11 Oct 2011 20:25:41 +0000 (+0200) Subject: Ensure the URL given to window.open() is absolute (Closes #1545). X-Git-Tag: xorg/1.1.4~55^2~4 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=ecd28ce878b37c7f0e8d027679ea22d00c1426f4;p=platal.git Ensure the URL given to window.open() is absolute (Closes #1545). This avoid issues on browsers with a buggy javascript implementation that resolve relative URL from dirname(window.location) instead of resolving it from the base URL provided through the markup in HTML. Signed-off-by: Florent Bruneau --- diff --git a/htdocs/javascript/xorg.js b/htdocs/javascript/xorg.js index f069982..67d106a 100644 --- a/htdocs/javascript/xorg.js +++ b/htdocs/javascript/xorg.js @@ -179,7 +179,7 @@ function auto_links() { } if ((!href.contains(fqdn) && !this.className.contains('popup')) || node.hasClass('popup')) { node.click(function () { - window.open(this.href); + window.open($.plURL(this.href)); return false; }); } @@ -816,7 +816,7 @@ function sendTestEmail(token, hruid) popWin: function(w, h) { return this.click(function() { - window.open(this.href, '_blank', + window.open($.plURL(this.href), '_blank', 'toolbar=0,location=0,directories=0,status=0,' +'menubar=0,scrollbars=1,resizable=1,' +'width='+w+',height='+h); @@ -1065,7 +1065,7 @@ function updatepromofields(egal1, egal2, promo2) { break; case 'admin': $(this).attr('href', 'admin/user/' + profile.hrpid) - .click(function() { window.open($(this).attr('href')); return false }); + .click(function() { window.open($.plURL(this.href)); return false }); break; } }