Link to home
Start Free TrialLog in
Avatar of mamuscia
mamusciaFlag for United States of America

asked on

How to get window.open to open a page in current subdirectory in HTTPS environment

I have a script running in an HTTPS site and I am unable to figure out how to use window.open to open a new page from the current subdirectory.  I've tried eveything to make the url appropriate, including hardcoding it.  All work in LOCALHOST which is not protected by HTTPS.  Here's a code snippet.  It sets the URL properly, but for some reason in the production HTTPS environment, it goes to the root directory and uses the parameters I give it, but with no page name.
//var urlscript = "http://" + window.location.host + "/^a/mox_accuInventoryGrid";
  var urlscript = window.location.protocol + "//" + window.location.host + "/^a/mox_accuInventoryGrid";
  //var urlscript = "^a/mox_accuInventoryGrid";
  var cb = Math.floor(Math.random()*3200);
  var parms = "?col="+col+
              "&row="+row+                      // MUST BE DEFINED IN SAME ORDER AS PARAMS COMING IN
              "&value="+value+                  // value of clicked on category, ie: SUN, IBM, ALLEN, etc
              "&category="+category+            // click on series (mfg, model, etc)
              "&series="+series+                    // mmmyyyy
              "&id="+id+                                 // DOM id of chart
              "&datelow="+datelow+              // filters low date
              "&datehigh="+datehigh+            // filters high date
              "&usermail="+usermail+            // filters high date
              "&cb="+cb;                        // cache buster must be last
  var url = urlscript+parms;
  alert("url-  "+url);
  var winopts = 'width='+screenwidth+',height='+screenheight+',left=0,top=0,scrollbars=1,menubar=0,toolbar=0,location=0,resizable=1,status=0,directories=0,copyhistory=0';
  invdetwin=window.open(url,'_blank',winopts);

Open in new window

Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Hi,
the script should in general work regardless of HTTP / HTTPS.
In what web server / framework do you host that site (source page where the script resides on)?
How does the script get invoked / called?
Any firewalls in between the browser and the web server?
The special char "^" in the url might be blocked by some firewalls.

HTH
Rainer
In the production environment do you have url rewriting going on in something like an apache .htaccess file or an iis filter or web config?
ASKER CERTIFIED SOLUTION
Avatar of mamuscia
mamuscia
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mamuscia

ASKER

After further research it appears as though there are errors in the page being called, so the error was not that javascript had issues opening the window, but in the content of the window being opened.