3

I have an ASP.NET MVC5 application on IIS Server and the login page is loading too slowly after clearing the history of the browser. As it can be seen on the Network field of Developer Tools, there seems to be a serious problem regarding to loading of page contents i.e. css and js files. So, could you please clarify me how to fix this problem for font-awesome and for the other files? How can I increase the page's and the other content's loading?Please note that I first load css files and then page content and at last javascript files. Any help would be appreciated...

enter image description here

1
  • One way is to use minified version of js. And the other one is to load all the js files in cache. Commented Dec 28, 2016 at 23:51

3 Answers 3

1

It seems your browser speed is low. As you've already used minified version and size is not greater than 25kb,still its taking 15 secs.

Other way is to cache those files in browser and reuse everytime(after first call)

caching JavaScript files

Browser Caching of CSS files

Also, i would suggest the following priority

1.Load JS Many times I've faced Js dependency problems. Make sure to load parent js first, then child. Also, try shuffling the js priority, might help you

2.Css

3.Page content

edit Google font offline Downloading a google font and setting up an offline site that uses it

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, you are right. Today I have tested several times by the same method and it is loaded just 1-2 seconds :) On the other hand, I think sometimes google-font may cause slowness if there is a problem for loading it. For this reason I used to include it to local but not worked properly. How can I use google-font in local? I tried to copy it to local and included by <link href="~/css/google-font.css" rel="stylesheet" />. Is there a better way to fix this problem?
I haven't used it but you have tried copying it but have you cleared the cache before using it??
Do you mean the browser's cache? I cleared by cleaning all of the history, but sometimes cannot be cleared completely. Any idea?
If you re using IE you have option to clear cache in dev tool(you can open it by pressing F12) almost for all browsers you can try ctrl+shift+Del and delete everything except history and stored passwords or preferences if any. Also i have updated my answer with some links for offline Google fonts
1

You can try bundling and minifying those assets in App_Start\BundleConfig.cs

1 Comment

Yes, you seem to be right. I can also try to it. Voted+. Also can you please look at my last comment regarding to google-fonts?
0

The cause of very slow loading of JS scripts and CSS files can be multiple and many answers have covered very well some possible causes.

I have myself run into such an issue, having a minified JS script of about 800KB which was taking 26 seconds to load (!). In my case, the file didn't have the X attribute set on the JS file on the server. Also gzip compression was not enabled on the server. After going through all the configuration steps to make gzip work and change permissions to allow the file to execute, it worked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.