如何在指定的打开的窗口中打开链接 [英] How to open a link in a specified, open window

查看:67
本文介绍了如何在指定的打开的窗口中打开链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个Web应用程序,它已集成到其他Web应用程序中,例如Salesforce.

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

现在我在Salesforce中有一个链接,该链接会打开我的应用程序的新窗口,但我希望它在已打开我的Web应用程序的窗口内打开该链接.

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.

场景:

  • tab1:mywebapp,tab2:salesforce
  • 单击tab2中的链接:链接在tab3中打开(链接应在tab1中打开)

我已经研究了链接的target属性,但是它们仅以命名框架为目标,我不确定如何将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?

tab1已经存在,所以我实际上无法执行使用名称打开新窗口"的操作.我将不得不通过代码使tab1拥有名称(通过URL打开tab1)

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)

推荐答案

您可以为打开的窗口命名.

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>


编辑

您可以在某些浏览器上命名窗口(或标签).

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>

它适用于IE,但不适用于Chrome ...

It works on IE, but not Chrome...

这篇关于如何在指定的打开的窗口中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆