Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] cocos does not start on mobile if loaded from <head> #3251

Open
metalim opened this issue Mar 31, 2016 · 0 comments
Open

[bug] cocos does not start on mobile if loaded from <head> #3251

metalim opened this issue Mar 31, 2016 · 0 comments

Comments

@metalim
Copy link

metalim commented Mar 31, 2016

_initSys has following chunk of code:

    // Adjust mobile css settings
    if (cc.sys.isMobile) {
        var fontStyle = document.createElement("style");
        fontStyle.type = "text/css";
        document.body.appendChild(fontStyle);

        fontStyle.textContent = "body,canvas,div{ -moz-user-select: none;-webkit-user-select: none;-ms-user-select: none;-khtml-user-select: none;"
                                + "-webkit-tap-highlight-color:rgba(0,0,0,0);}";
    }

_initSys is executed right away, when library is loaded.
When library is loaded from <head> there is no document.body yet! So the code above fails with error at document.body.appendChild

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant