Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a link in a specified, open window

I have this web application which has integrations into other webapps like Salesforce.

Now I have a link in Salesforce which opens a new window of my application, but I would like it to open the link inside the window, where my webapp is already open.

Scenario:

  • tab1: mywebapp, tab2: salesforce
  • click link in tab2: link opens in tab3 (link should open in tab1)

I've looked into target attribute of links, but they only target named frames and I'm not sure how I could name tab1 to be a valid target.

Any other hints people can give me?

Edit:

tab1 already exists, so I can't actually do the 'open a new window with a name' thing. I'd somehow have to either make tab1 have a name through code (tab1 is opened via URL)

like image 596
deiga Avatar asked Sep 02 '25 09:09

deiga


1 Answers

You can give a name to the window you opend.

<a href="#" onclick="window.open('http://www.stackoverflow.com', 'mywin'); return false;">Click here to open window first</a>
<br/>
<a href="#" onclick="window.open('http://www.google.com', 'mywin'); return false;">Open link in specific window</a>


Edit

You can name a window (or tab) on some browsers.

<script>
    this.name = "mywin";
</script>

And open a link to the tab.

<a href="http://www.stackoverflow.com" target="mywin">Open link in specific window</a>

It works on IE, but not Chrome...

like image 155
iForests Avatar answered Sep 03 '25 22:09

iForests