Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes HTML, CSS and JavaScript and the fly likes Opening HTTPS link in same popup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Opening HTTPS link in same popup" Watch "Opening HTTPS link in same popup" New topic
Author

Opening HTTPS link in same popup

Jon Christensen
Greenhorn

Joined: Apr 14, 2003
Posts: 21
I have links that are https that need to open in a secondary window named 'NEWWINDOW'. I would like all of the links on a page to open in the same secondary window instead of opening a new window every time. The code below works fine when the link is HTTP but I always get a new window with HTTPS.
Here is my code:
in the .jsp file:

in newWindow.js file

Every time View Detail is clicked on the same page or different pages,
a new window is created. The link always begins with https. I tested
the above with http and it works fine.
Thanks for any help you can give,
Jon
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
http://www10.brinkster.com/A1ien51/Scripts/PopUpCheck.htm
look at the 2nd script, I think it might work in your case to get around te problem with the secure connection.
Eric
[ January 07, 2004: Message edited by: Eric Pascarello ]
Jon Christensen
Greenhorn

Joined: Apr 14, 2003
Posts: 21
It looks like it should work but I don't understand what 'AlienPop' is. Also, doesn't the new window need a name so I reference the same window from other pages?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
the AlienPop is just an object. You can rename it to whatever you want it to be. You look at the object and that shows if the window exsists or not. You can add in the window name to the window.open funtion. I just leave it to be very generic on my page.
Eric
himanshu patel
Ranch Hand

Joined: Feb 03, 2003
Posts: 205
Originally posted by Jon Christensen:


DO you really need target="NEWWINDOW" ?
Try removing this?


If you want to become a rich, do not work for others but make others to work for you.
Jon Christensen
Greenhorn

Joined: Apr 14, 2003
Posts: 21
Removing the target did not help and now I can't get the javascript to work in a .js file.
The following gives an error, AlienPop is undefined.

If I add "var AlienPop = new Object();" to the top of the .js file, AlienPop.location is null when clicking the link.
I am sure I am missing something obvious but javascript has always confused me.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I got this to work.
Jon Christensen
Greenhorn

Joined: Apr 14, 2003
Posts: 21
That works for one page and all the links on that page. Is there a way to reuse that same popup on different pages?
For example,the user is on page1.jsp, clicks on View Details and gets a secondary window.
Then the user selects a link to page2.jsp which opens in the main window (the secondary window is still open). After clicking on View Details on page2.jsp, another secondary window opens. I would like this View Details link to open in the same secondary window from page1.jsp.
Is this possible?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Once you change pages on the main window you loose the reference to the pop up window. I know one way to get around it is with a hidden frame where the code resides, but then you have a framed site.
I remember a friend playing with this idea, so I will talk to them and see if he ever came up with a solution about not loosing the object.
Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Opening HTTPS link in same popup