PDA

View Full Version : Pop Up Window not reusing itself?


kelemvor
02-18-2003, 06:30 PM
Howdy all,

Thsi is probably a really dumb syntax error but I'm overlooking it. I'm using a JavaScript line to integrate a Paypal shopping cart type thing to a website and this is the line that's attached to a "Add to Cart" button

onclick="window.open('https://www.paypal.com/cart/add=1&business=blah%40juno.com&item_name=Residential+Listing+Contract+-+x1&item_number=WB-1&amount=0.55&image_url=','cartwin','width=600,height=400,scrollbars,location,resizable,status'); target='contents'"

I've tried putting the target=contents in a couple different spots with no change.

What i want to happen is the first time the user clicks one of the buttons, it opens a pop up with their item. Then when they click "Continue SHopping" it's coded to just minimize itself (I can't control this). But when they click another button, I just want it to reactivate the minimized window but instead it's opening a new pop up window with the new information.

Not sure why. Any suggestions?

Quiet Storm
02-18-2003, 06:46 PM
cartwin is the window name.

In that link, you do not need to target='contents' because that is for another window named contents. The original window is named cartwin and clicking on the link again will refresh the window.

:D

kelemvor
02-18-2003, 06:53 PM
That's true. The target= part was left over from something else and I forgot to delete it. However, the cartwin part is still opening a new window every time. Is that because the script uses WINDOW.OPEN? is there some other command that will not actually open a NEW window if there's already a window with that name in existence?

Quiet Storm
02-18-2003, 07:21 PM
Seems to be a problem with the paypal page... If I put a different URL it works fine, but it doesn't seem to like that URL.

I can't find any info in their coding that would make it do that - maybe I'm missing something?

Sorry.

kelemvor
02-18-2003, 11:06 PM
Hopefully someone else will be able to spot the problem.

kelemvor
02-18-2003, 11:56 PM
Well I've confirmed it's NOT something in the link because I took out all the crap and just left it like this:

onclick="window.open('https://www.paypal.com/','cartwin')"

and it still doesn't work. Opens a new eindow every time. Gotta be something with the window.open command or the name I guess.

Any help?

glenngv
02-19-2003, 02:13 AM
maybe because of https for security reasons. just a guess :D

kelemvor
02-19-2003, 03:28 AM
Well, that seems to be it. I tested it with yahoo.com and it worked fine. So I guess the question is... Is there any way to force it to use the already created window even though it's a secure site?

A1ien51
02-19-2003, 07:06 AM
Here is a suggestion to try, I did not test it


<script>
function OpenIt(TheUrl){
if (WinPop && !WinPop.closed){
WinPop.location.href=TheUrl;
WinPop.focus();}
}

else{
WinPop=window.open(TheUrl);
}
}
</script>

onclick="OpenIt('https://www.paypal.com/cart/add=1&business=blah%40juno.com&item_name=Residential+Listing+Contract+-+x1&item_number=WB-1&amount=0.55&amp;image_url=','cartwin','width=600,height=400,scrollbars,location,resizable,status')"