【问题标题】:Page only accessible via joomla iframe and not in browser页面只能通过 joomla iframe 访问,不能在浏览器中访问
【发布时间】:2013-01-24 12:07:34
【问题描述】:

我有一个显示基于 Web 的应用程序的 Joomla iframe。现在我想阻止人们浏览我使用的页面,例如:http://www.mywebsite.com/webapplicationname/login.php

当浏览到那里时,它们应该会自动被重定向到http://www.mywebsite.com 并在 iframe 中登录。

所以我想阻止人们浏览我的网络应用程序,并且只能通过 iframe 访问它。有什么办法可以做到吗?或者至少阻止人们通过浏览器而不是 iframe 访问登录页面?

【问题讨论】:

    标签: php redirect iframe joomla


    【解决方案1】:

    这是检查页面是否加载到 iframe 中的 javascript 代码:

    <script type="text/javascript">if (top === self) { not in a frame } else { in a frame }</script>
    

    然后你可以把打开iframe的代码放在else里面

    【讨论】:

    • 所以如果页面加载到 iframe 中,我只需要显示 html,如果没有将其重定向到包含 iframe 的页面。但是javascript可以被禁用,所以它对我来说还不是完美的解决方案。如果没有其他方法的话。
    • 我认为没有其他选择。要检查页面是否加载到 iframe 中,需要在您的计算机上执行代码(使用 javascript)。我应该尽量避免使用 iframe,而是使用 div。
    • 这有点问题。它需要与 Joomla 分开,所以我不能在其中包含 div 等,因为那样它将取决于 Joomla。但感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 2020-05-26
    • 1970-01-01
    • 2018-06-24
    • 2021-09-12
    • 1970-01-01
    • 1970-01-01
    • 2023-04-02
    • 2013-11-15
    相关资源
    最近更新 更多