Ensure the URL given to window.open() is absolute (Closes #1545).
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 11 Oct 2011 20:25:41 +0000 (22:25 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 11 Oct 2011 20:25:41 +0000 (22:25 +0200)
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 <base> markup in HTML.

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
htdocs/javascript/xorg.js

index f069982..67d106a 100644 (file)
@@ -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;
                     }
                 }