Skip to content

Wouldn't it be better to load JavaScript in the body? #33

@blizarazu

Description

@blizarazu

Usually it is recommended to place the <script> tags right before closing the body tag (</body>) so that the browser's parser doesn't get blocked until all the JavaScript is downloaded. Wouldn't it be better to place the <script> tag at the bottom of the body of index.html?

<!DOCTYPE html>
<html ng-app="<%=appName%>" ng-controller="AppController">
<head>
    <title ng-bind="pageTitle"></title>

    <!-- font awesome from BootstrapCDN -->
    <link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">

    <!-- compiled CSS --><% styles.forEach( function ( file ) { %>
    <link rel="stylesheet" type="text/css" href="<%= file %>" /><% }); %>
</head>
<body>
    <header>
        <nav class="container navbar-default">
            <ul class="nav navbar-nav">
                <li ui-sref-active="active">
                    <a ui-sref="home">Home</a>
                </li>
                <li ui-sref-active="active">
                    <a ui-sref="about">About</a>
                </li>
            </ul>
        </nav>
    </header>

    <div class="container" ui-view="main"></div>

    <footer class="container">
        (c) <%= date %> <%= author %>
    </footer>

    <!-- compiled JavaScript --><% scripts.forEach( function ( file ) { %>
    <script type="text/javascript" src="<%= file %>"></script><% }); %>
</body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions