使用两个嵌套的iframe时阻止打开新选项卡 [英] Prevent opening new tab while using two nested iframes

查看:285
本文介绍了使用两个嵌套的iframe时阻止打开新选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello stackoverflow fellas,我在这里面临一个问题。我给其他家伙提供了 iframe 代码,将其嵌入到他的网站上。

Hello stackoverflow fellas, I am facing a problem here. I gave a iframe code to other fella to embed it on his website.

这是代码 iframe

Here is the code of iframe:

  <iframe height="100%" width="100%" frameborder="0" scrolling="auto" src="http://www.mywebsite.com/iframecode" type= "text/javascript"></iframe> 

以上 iframe 包含以下内容 html

The above iframe contains following html:

<html>
<head>
</head>
<body>
//... some html code
<iframe src="http://www.paymentgatway.com/pay" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>
//... some html code
</body>
</html>     

上面 html 包含另一个 iframe 用于支付(第三方)。

Here above htmlcontains another iframe which is used to make a payment(third party).

问题:

所以问题是当他点击付费按钮时在第二个 iframe 中,它会将3D安全页面打开到新标签页,而不是将其打开到同一页面。

So the problem is when he clicks on pay button which is in second iframe, it opens 3D security page to new tab instead of opening it to same page.

我在< head> < base target =_ self/> >我的iframe html的标签,但没有运气。

I have tried <base target="_self"/> in <head> tag of my iframe html, but no luck.

我已经测试直接使用付款iframe,当我点击付费按钮时它会打开窗口。

I have tested using payment iframe directly, when I click pay button it opens in same window .

请你能改变我的运气吗?

Please, can you change my luck?

推荐答案

我看到两件重要的事情:

I see two important things:


  1. Mixin HTTP with HTTPS 不是一个好习惯(除非你试图欺骗某人),即使你这样做,通常安全页面或浏览器也会阻止你。

  2. 如果 paymentgatway.com 已正确编码,那么它将不允许您加载 iframe 安全原因

  1. Mixin HTTP with HTTPS is not a good practice (unless you try to cheat someone) and even if you do, normally the secure page or the browser will block you.
  2. If paymentgatway.com has been coded properly, then it will not allow you to load inside an iframe for security reason

所以,基于:


我已经使用iframe直接测试,当我点击付费按钮
时,它会在同一个窗口中打开。

我会说你在这两种情况都面临。

结论:

除非您拥有这两个域并且可以修改 paymentgatway.com 的源代码,否则您不能这样做页面。

Conclusion:
You can't unless you own both domains and can modify the source code of paymentgatway.com page.

这篇关于使用两个嵌套的iframe时阻止打开新选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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