该网页的iFrame中显示服务器端检测 [英] Server-side detection that a page is shown inside an IFrame
问题描述
是否有可能确定 - 服务器端 - 无论是页面内被加载的IFrame
Is it possible to determine - server-side - whether a page has been loaded within an IFrame
?
在某些错误在我的应用程序出现用户被重定向到 Default.aspx的
并显示错误消息。该错误消息的文本获取会议通过的异常处理code设置。一旦它已被显示的错误消息被从会话清除。
When certain errors happen in my application the user gets redirected to Default.aspx
and an error message is shown. The text of that error message gets set in session by exception handling code. The error message gets cleared from session once it has been shown.
不过,我的应用程序的一部分,必须使用的IFrame
(它做一个3D安全卡支付支票,其中准许一个的IFrame
,以显示卡供应商的验证UI)。如果错误在此过程中发生的我重定向发生在的IFrame
的效果。我使用JavaScript来检测这一点,并重新加载 Default.aspx的
正确的,但是这意味着我得到两个 Page_Loads
快速接着,与该错误消息仅被显示在第一个(然后清零)。
However, part of my application has to use an IFrame
(it's doing a 3D Secure card payment check, which mandates an IFrame
in order to display the card provider's authentication UI). If an error takes place during this process my redirect takes effect within the IFrame
. I am using JavaScript to detect this and reload Default.aspx
correctly, but this means that I get two Page_Loads
in rapid succession, and the error message only gets shown on the first one (and then cleared).
推荐答案
可以做到在客户端:<一href=\"http://stackoverflow.com/questions/326069/how-to-identify-if-a-webpage-is-being-loaded-inside-an-iframe-or-directly-into-t\">How如果网页加载一个iframe中,或直接到浏览器窗口来识别?
我找到了解决办法是把一些标识到里面的iframe打开一个URL查询字符串的
The workaround i found is put some identifier into querystring of a url opened inside iframe.
这篇关于该网页的iFrame中显示服务器端检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!