How do I find the virtual viewport/screen width using Javascript?

前端 未结 3 1787
无人及你
无人及你 2021-01-02 09:39

Is there a consistent way to determine the width of the screen and virtual viewport for mobile devices using Javascript? My target platforms are mobile Safari and Android\'

3条回答
  •  孤城傲影
    2021-01-02 10:10

    Another StackOverflow question has this as a workaround:

    setTimeout(YourFunction, 200);
    

    And if you want the details, you can read about the bug in the issue tracker. You're experiencing a bug that exists in Android 2.2 and 2.3.

提交回复
热议问题