使用两个嵌套的iframe时阻止打开新选项卡

编程入门 行业动态 更新时间:2024-10-27 19:25:13
本文介绍了使用两个嵌套的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="www.mywebsite/iframecode" type= "text/javascript"></iframe>

以上 iframe 包含以下内容 html :

The above iframe contains following html:

<html> <head> </head> <body> //... some html code <iframe src="www.paymentgatway/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> 我的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:

  • Mixin HTTP with HTTPS 不是一个好习惯(除非你试图欺骗某人),即使你这样做,通常安全页面或浏览器也会阻止你。
  • 如果 paymentgatway 已正确编码,那么它将不允许您加载 iframe 安全原因
  • 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.
  • If paymentgatway has been coded properly, then it will not allow you to load inside an iframe for security reason
  • 所以,基于:

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

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

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

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

    更多推荐

    使用两个嵌套的iframe时阻止打开新选项卡

    本文发布于:2023-11-27 20:48:47,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1639550.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:嵌套   选项卡   开新   两个   iframe

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!