简体   繁体   English

在弹出窗口(外部网站)中禁用某些导航链接

[英]disable certain navigation links in popup window (external website)

Hi I am opening an external website in my pop window. 嗨,我正在弹出窗口中打开一个外部网站。 I would like to disable certain links in that popup. 我想禁用该弹出窗口中的某些链接。

ie I am opening http://www.yahoo.com in pop and I want to disable some links in that pop-up so that who ever visit yahoo.com using my website, will not able to click on some links... 即我正在弹出窗口中打开http://www.yahoo.com ,我想禁用该弹出窗口中的某些链接,以便曾经使用我的网站访问yahoo.com的人将无法单击某些链接...

Is it possible? 可能吗? any idea? 任何想法?

It is impossible to run JavaScript on another domain because of the same origin policy. 由于具有相同的原始策略,因此无法在其他域上运行JavaScript。 imagine someone opening up your bank account in a new window/frame and altering the links to transfer money to their account. 假设有人在新窗口/框架中打开您的银行帐户,并更改了将资金转入其帐户的链接。 ;) ;)

You can screen scrape the content with your server and redisplay it, but you have to worry about proxying all of the relative links. 您可以使用服务器在屏幕上抓取内容并将其重新显示,但是您必须担心代理所有相对链接。

If you are creating a popup using the standard window.open you can manipulate the DOM of that document. 如果使用标准window.open创建弹出窗口,则可以操作该文档的DOM。 See here for more information on how to do that (towards the bottom of the page). 有关如何执行此操作的更多信息,请参见此处 (朝页面底部)。 But this is fairly limiting to writing stuff to that page. 但这在将内容写入该页面方面相当有限。 I suppose you could render the link in an iframe and inject some javascript to manipulate it? 我想您可以在iframe中呈现链接并注入一些JavaScript来操纵它?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM