stripping port numbers from the location.host string when
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 12 Sep 2006 02:00:16 +0000 (02:00 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 12 Sep 2006 02:00:16 +0000 (02:00 +0000)
building opac links - explicit ports were leaking in
in some cases (in this case, safari takes a literal :80 from
an apache redirect).  The opac does not work on non-standard
ports as it stands, so no harm done

git-svn-id: svn://svn.open-ils.org/ILS/trunk@6070 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/opac_utils.js

index f7728bd..24ffb52 100644 (file)
@@ -239,7 +239,13 @@ function findBasePath() {
 function findBaseURL(ssl) {
        var path = findBasePath();
        var proto = (ssl) ? "https:" : "http:";
-       return proto + "//" + location.host + path;
+
+       /* strip port numbers.  This is necessary for browsers that
+       send an explicit  <host>:80, 443 - explicit ports
+       break links that need to change ports (e.g. http -> https) */
+       var h = location.host.replace(/:.*/,''); 
+
+       return proto + "//" + h + path;
 }
 
 /*