I want to open a window with JS on a page (the page contains an editor) and you can add items to this editor from the website where there are buttons "add to editor".
When a user clicks an "add to editor" button I want to determine if the editor is already open and if so execute some JS on that (so I can add it) or open a new window with the editor.
When I use the following code:
window.open('/editor', 'editor');
This works fine for opening a window named editor. But when someone has the editor open and clicks the same button on another page, the editor is refreshed which is not what I want.
I can't store the window.open result in a variable (e.g var foo = window.open()
) since that only works on one page. Is there another way to do this?
If it is easier with jQuery, I am using that too. So that is a possibility.