【问题标题】:if window size is 300x500 then open page else redirect php code如果窗口大小为 300x500,则打开页面,否则重定向 php 代码
【发布时间】:2013-08-01 15:52:15
【问题描述】:

我需要一些具有已定义窗口大小的 php 代码,如果大小为 true,则运行该页面,如果不重定向到另一个页面。我将使用 iframe 管理窗口大小。用php可以吗?如果没有,还有其他方法吗。

【问题讨论】:

    标签: php iframe window size


    【解决方案1】:

    这是一个小 javacript,它检查宽度和高度,然后设置文档位置,如果它不是您指定的,但它正在从 php.ini 中回显。您可以使用 maxheight、max width 和 url 变量。

    <?php 
     $jssnippet = "<script type='text/javascript'>var width = window.innerWidth; 
     var height= window.innerHeight; 
     var maxheight=480; 
     var maxwidth=360;
     var redirecturl='http://www.xl21.org';
     if((width>maxwidth) && (height>maxheight)){document.location=url; }</script>"; 
    
    echo $jssnippet;
    ?>
    

    【讨论】:

      【解决方案2】:

      PHP 不可能知道窗口大小。

      这是 JavaScript 的任务。

      Example of getting window size with JS

      【讨论】:

      • 请给我js脚本
      • 你去,现在检查答案
      • 我不明白我在哪里定义了窗口大小
      • 我不知道,如果您有一点时间,请您制作代码。请
      • 好吧,这对你来说很愚蠢,但对我来说却无能为力。我只是要求你,如果你不能让一些人感到高兴,请不要听到他们的声音。抱歉英语不好。跳你懂的。我不邀请你回答它。你来你自己。再见
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多