简体   繁体   中英

JavaScript : window.open() function opening link in new window instead of proving same window name in IE7

I have two buttons (A & B) on a page which opens a new window on click. Both the buttons are using same JavaScript function and the windowName is passed dynamically ( _AWindow is passed for button A and _BWindow is passed for button B).

JavaScript code to open window is:

window.open(s_url,windowName); 

I am facing following strange problem.

If I click on button A first time then it opens link( https://www .) in a new window(name : _AWindow) and again clicking the same button opens the link in existing window.

BUT

If I click on button B first time then it opens link( https://secure . ) in a new window (name : _BWindow) but again clicking the button B it again opens a new window instead of opening link in same window.

I am using IE7 version 7.0.5730.13

Please help!

Do you have a global variable with the name "name" in the page opening in _BWindow ? Changing the value of the global would rename the window, causing the second launch to fail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM