Suppose, i have two chrome instance opened, instance1 and instance2, and my application is running in instance1, and when user do any click event on instance1, Can i open new url in instance 2 using javascript?
Asked
Active
Viewed 381 times
0
-
1Does this answer your question? [how to set an ID to a newly opened window?](https://stackoverflow.com/questions/17568669/how-to-set-an-id-to-a-newly-opened-window) – jeprubio Dec 22 '19 at 15:12
-
Does this answer your question? [Target='\_blank' to show in new window, NOT new tab, possible?](https://stackoverflow.com/questions/1834559/target-blank-to-show-in-new-window-not-new-tab-possible) – Craicerjack Dec 22 '19 at 15:13
-
Not exactly, i have senario like, i need to open new tab in instance 2. Replacing it with new url is not option for now. Do you have any idea? – Bikash Burma Dec 22 '19 at 15:27
1 Answers
0
If the second instance is not opened from your application, then it have no authority to access that instance.
I would suggest using window.open from your application, then you can pass an additional parameter as per your requirements. This way you will have control over the other instance you have created.
Reference: https://www.w3schools.com/jsref/met_win_open.asp
Updated
Regarding your comment:
You can add multiple event listeners for you instance window to detect changes on them like (load, close, resize etc).
componentDidMount() {
let strWindowFeatures = 'location=yes'
let URL = 'http://localhost:3001'
let win3Instace = window.open(URL, '_blank', strWindowFeatures)
win3Instace.addEventListener('load', (event) => {
console.log('Instance 3 is loaded, add callback funtion here')
})
}

prabin badyakar
- 1,636
- 2
- 16
- 24
-
so lets suppose i open a new instance like let instance3=window.open(url, name, '') in new window, then do you have any idea if i can open url1, url2 in different tab in instance3, while my app is in instance1. – Bikash Burma Dec 22 '19 at 15:31
-
@BikashBurma I've updated my answer. Hope this will be helpful for you :) – prabin badyakar Dec 22 '19 at 16:10