I have a view layout (main.cshtml) where I am calling an external javascript file. I have renderings (another cshtml files) which are included as placeholders to this layout(main.cshtml). example: two pages: 1) http://localhost/home/ has two renderings for Body placeholder 2)http://localhost/about/ has two renderings for Body placeholder
both home and about pages uses same main.cshtml, I don't want to load externalJS.js every time I navigate from home to about or vice versa. i.e;the externalJS.js should load once for entire application. Can I achieve it?
<!DOCTYPE html>
<html>
<head>
<title>Main</title>
</head>
<body>
<div data-role="page" class="pageWrapper">
<header data-role="header" class="header">
@Html.Sitecore().Placeholder("Header")
</header>
<div class="wrapper" data-role="main">
@Html.Sitecore().Placeholder("Body")
</div>
<div data-role="footer" role="contentinfo" class="ui-footer ui-bar-inherit">
@Html.Sitecore().Placeholder("Footer")
</div>
</div>
<script src="../../js/externalJS.js"></script>
</body>
</html>