Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 23rd, 2015, 02:08 PM
Authorized User
 
Join Date: May 2013
Posts: 59
Thanks: 10
Thanked 0 Times in 0 Posts
Default Optimize the order of styles and scripts

Hello I am using GTMetrix website to evaluate my website and I got this:


The following external CSS files were included after an external JavaScript file in http://mywebsite.com/. To ensure CSS files are downloaded in parallel, always include external CSS before external JavaScript.

http://mywebsite.com/App_Themes/Mono...onochrome2.css


I built my website based on the planet wrox covered in the book:
here is my master page that included the modernizer script:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Frontend.master.cs" Inherits="MasterPages_Frontend" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<link id="Link1" runat="server" rel="shortcut icon" type="image/x-icon" href="~/favicon.ico" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>

<link href="../App_Themes/Monochrome/Monochrome2.css" rel="stylesheet" />
<script src="/Scripts/modernizr-2.8.3.js"></script>
</head>
<body>
<%-- <div id="wrapper"> --%>
<form id="form1" runat="server">
<div id="PageWrapper">
<div class="beforeHead"></div> <header> </header>
<section id="MainContent">
<asp:ContentPlaceHolder ID="cpMainContent" runat="server"><header> </header>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
<Scripts>
<asp:ScriptReference Name="jquery" />
</Scripts>
</asp:ScriptManager>
</asp:ContentPlaceHolder>
</section>
<footer>
<hr class="hr"/>
<span >Copyright &copy; 2014 EAS company - All Rights Reserved </span>
</footer>
</div>
<asp:ContentPlaceHolder ID="cpClientScript" runat="server">
</asp:ContentPlaceHolder>
</form>
<%--</div> --%>
</body>
</html>


Please help me!
 
Old June 24th, 2015, 03:45 AM
Registered User
 
Join Date: Jun 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Good question
 
Old June 24th, 2015, 05:44 PM
Authorized User
 
Join Date: May 2013
Posts: 59
Thanks: 10
Thanked 0 Times in 0 Posts
Default

ok I wanted to update and also to ask if this is the solution.
I moved the
<script src="/scripts/modernizr-2.8.3.js"></script>
from the head section to the body .
The warning at GTMetrix is gone but is this the solution?
So, now that the script src is in the body does it really affect the page or not?
Thanks
 
Old June 25th, 2015, 02:44 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, it does. It allows the browser to process the HTML and apply the CSS while it's downloading the JavaScript.

You can read more about the why here: https://www.google.com/?gws_rd=ssl#q...and+JavaScript

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old June 25th, 2015, 02:57 PM
Authorized User
 
Join Date: May 2013
Posts: 59
Thanks: 10
Thanked 0 Times in 0 Posts
Default

Thank you!





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with order of application of styles hertendreef ASP.NET 2.0 Basics 0 May 15th, 2007 03:28 AM
to optimize the code-urgent mikedeepak Classic ASP Professional 1 November 4th, 2005 03:00 AM
Optimize SQL Statement JpJoe Access 1 June 7th, 2005 08:19 AM
Optimize Raul Classic ASP Databases 3 February 10th, 2004 02:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.