【问题标题】:my website does not show on an iphone browser and I not know why我的网站没有显示在 iPhone 浏览器上,我不知道为什么
【发布时间】:2015-09-02 03:55:47
【问题描述】:

我不知道为什么,但我的网站没有显示在移动 Safari 上。我添加了

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

它在我的 mac chrome 和 safari 上显示良好,但在我的 iphone 或 iphone 模拟器上却没有。据我所知,我正在使用 bootstrap 3 和 reactjs,它们应该可以在移动设备上正常工作。这让我把头发拉了出来,所以如果有人有任何建议,将不胜感激。

我的网站是http://register.versame.com

【问题讨论】:

  • 我刚查了,没问题!

标签: twitter-bootstrap mobile reactjs


【解决方案1】:

是的,您的网站无法在我的 Macbook 和模拟 iPhone 5s 的 Safari 上显示任何内容。

我在两个 Safari 实例上都收到以下错误:SyntaxError: Unexpected token '('. Expected a ':' following the property name 'render'. (main.js:94490)

查看代码,我看到你写的是:

var NotFound = React.createClass({
    displayName: "NotFound",
    render() {
        window.location = '/notfound';
    }
});

代替:

var NotFound = React.createClass({
    displayName: "NotFound",
    render: function render() {
        window.location = '/notfound';
    }
});

现在,至于为什么你的网站还在 Chrome 中运行,那是因为 Chrome 支持 ES6 的 shorter syntax for method definitions 而 Safari 不支持。

注意:我使用this article 允许我在模拟 iPhone 上检查您的网站。

【讨论】:

  • 你太棒了。谢谢。我一直在按照您发布的链接寻找 Safari 上的开发者按钮。
  • Safari —> 首选项 —> 高级 —> 在菜单栏中显示开发菜单。
  • @MatthewChung 查看我的更新答案,它解释了为什么您的网站在 Chrome 中运行。
  • 这非常有用。
【解决方案2】:

我观察到由于您网站的 Main.js 文件中的错误,它没有在少数浏览器上加载。

一个错误是:SyntaxError: Expected an identifier but found '(' instead at var main.js:94490

不正确的代码:

NotFound = React.createClass({displayName: "NotFound",
    render() {
        window.location = '/notfound';
    }
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-18
    • 2013-02-25
    • 2010-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多