简体   繁体   English

iOS上的页面冻结加载查询

[英]Page Freezes on iOS Loading Query

I have a client site that has two specific CSS and JS files, one for desktops and one for iOS devices: 我有一个客户端站点,其中包含两个特定的CSS和JS文件,一个用于台式机,一个用于iOS设备:

<?php if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod') || strstr($_SERVER['HTTP_USER_AGENT'],'iPad')) 
    {
        echo '<link rel="stylesheet" type="text/css" href="http://example.com/style.mobile.css" />
        <script type="text/javascript" href="http://example.com/js/scripts.mobile.js"></script>';
    }else{
        echo '<link rel="stylesheet" type="text/css" href="http://example.com/style.css" />
        <script type="text/javascript" href="http://example.com/js/scripts.js"></script>';
    } 
?>

If I load either CSS/JS set, the site works just as it should. 如果我加载了CSS / JS集,则该站点将正常运行。 If I add this IF statement, the site hangs and never loads. 如果添加此IF语句,该站点将挂起并且永远不会加载。

Even more puzzling, is that I'm using the exact same IF statement to load different elements on the same page and it works just as it should. 更令人困惑的是,我使用的是完全相同的IF语句,以便在同一页面上加载不同的元素,并且它按预期方式工作。 Is there something about using it in the header, or with JS that I'm unaware of? 关于在标头中使用它,或者与我不知道的JS有什么关系?

Or, is there a better, more bulletproof way to go about this? 或者,是否有更好,更防弹的方法来解决此问题?

Thanks, 谢谢,

ty ty

Swapnesh's suggestion actually worked. Swapnesh的建议实际上是有效的。 I'd really like to understand why. 我真的很想知道为什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM