Website design, we can now choose the browser is very much, so the browser environment is also a great variety, the same browser also contains a variety of different versions, there are also differences between different versions of rendering methods, characteristics of HTML5 they support that are not the same, believe that this is a comprehensive website will encounter problems. Already by 2014, and said the new features of HTML5, it was very late, but rarely seen in the introduction to HTML5 books, but also can be easily used in their website, so a product Witkey specially to introduce.
First, the Download attribute
The Download property of HTML5 is used to force the browser to download the corresponding file instead of opening it. Chrome and Firefox browser too powerful, perhaps in order to enhance the user experience, when the user clicks the resource file can be identified when they (for example, PDF will be directly in the browser to open, MP3, MP4 and other media directly using a browser built-in player). But sometimes the user actually wants to download directly instead of looking in the browser, and then you can add this property, which will rename the downloaded file.
Two. DNS pre parsing cache is known to all. Parsing DNS is an important part of website performance optimization, although it's hard to compress when the load time is not too long. Especially for concurrent downloading of resources and use multiple CDN domain names to load resources of large sites, but also can not be ignored, each load of resources prior to the CDN domain name DNS resolution conversion. If the DNS is preloaded, the browser that supports it will parse the domain in advance and cache it without parsing it when it needs to be asked to DNS.
Three, resource pre loading portal development, resource pre loading, there are many ways, such as common pictures pre loaded, there are CSS background images used to preload, most of them are still using JS. Currently, HTML5 provides a specialized resource Preload Method with two attributes: prefetch (pre read) and prerender (pre render), supported by Firefox and Chrome browsers, respectively.
1).PREFETCH pre read prefetch is pre loaded resources very common, after the current page is loaded, you will be in the back secretly download the specified resource, is generally JS, CSS and pictures of this class, you can also download page.
2).PRERENDER pre render this more fierce, not only secretly download in advance, but also give you rendering out, when the user clicks on the link, immediately show you.
Search engine is the most in need of such pre read function, because they are very determined the next user to open the page (search results page), so when the user enters the search content, you can put the search results page loaded in advance of the resources in advance, and after application, the effect is obvious.
And, of course, there is no cross domain preload for security, and it probably won't work in CDN.
沒有留言:
張貼留言