javascript - window.open is not opening again in the same window -


every time specific page reloads, popup window opened google search of contained in 2nd . issue keeps opening in new window instead of inside original popup.

var td_name = $("td:eq(1)"); var td_text = td_name.text(); window.open("http://www.google.com/search?q="+td_text+"", "mywindow", '_blank'); 

the browser security model has prevented while (understandably). work if "reload" done js , not full browser refresh.

see related answer workaround using window references:

no. without reference window, can't find again, name or otherwise. there no collection of windows.

update: here's how yourself:

var windows = {}; function openwindow(url, name, features) {     windows[name] = window.open(url, name, features);     return windows[name]; } 

now, openwindow open window, , if window exists, load given url in window , return reference window. can implement findwindow:

function findwindow(name) {     return windows[name]; } 

which return window if exists, or undefined.

you should have closewindow, don't keep references windows opened yourself:

function closewindow(name) {     var window = windows[name];     if(window) {         window.close();         delete windows[name];     } } 

if not possible, point giving windows names?

the name used internally browser manage windows. if call window.open same name, won't open new window instead load url opened window. there few more things, mdn window.open():

if window name strwindowname exists, strurl loaded existing window. in case return value of method existing window , strwindowfeatures ignored. providing empty string strurl way reference open window name without changing window's location. open new window on every call of window.open(), use special value _blank strwindowname.

source: https://stackoverflow.com/a/9364899


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -