portals-portalapps-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r817242 - /portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/javascript/iframe_handler.js
Date Mon, 21 Sep 2009 13:24:38 GMT
Author: woonsan
Date: Mon Sep 21 13:24:37 2009
New Revision: 817242

URL: http://svn.apache.org/viewvc?rev=817242&view=rev
Log:
APA-17: Using relative urls as possible to store last visited page in session.

Modified:
    portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/javascript/iframe_handler.js

Modified: portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/javascript/iframe_handler.js
URL: http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/javascript/iframe_handler.js?rev=817242&r1=817241&r2=817242&view=diff
==============================================================================
--- portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/javascript/iframe_handler.js
(original)
+++ portals/applications/webcontent/trunk/webcontent-war/src/main/webapp/javascript/iframe_handler.js
Mon Sep 21 13:24:37 2009
@@ -29,9 +29,16 @@
 function iframePortlet_recordVisitPage(iframe) {
   try {
     var xmlHttp = (window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));
+    var visitedPage = "" + iframe.contentWindow.location.href;
+    if (window.location.href.match(/^(https?:\/\/[^\/]+)\/?/)) {
+      var baseURL = "" + RegExp.$1;
+      if (visitedPage.indexOf(baseURL) == 0) {
+        visitedPage = visitedPage.substring(baseURL.length);
+      }
+    }
     var visitResourceURL = "" + iframe.getAttribute("visitresourceurl");
     visitResourceURL += (visitResourceURL.indexOf("?") > 0 ? "&" : "?");
-    visitResourceURL += ("URL=" + iframe.contentWindow.location.href);
+    visitResourceURL += ("URL=" + encodeURIComponent(visitedPage));
     xmlHttp.open("GET", visitResourceURL, true);
     xmlHttp.onreadystatechange = iframePortlet_onreadystatechange;
     xmlHttp.send(null);



Mime
View raw message