Increase the speed of opening Android local documents

Source: Internet
Author: User

Many Android developers have a headache when referring to the official Android API: Opening a index.html on average takes a few minutes or more, especially if you open the API version above 8. Is the internet not good enough? But the author uses the Netcom 8M broadband, so basically can rule out the speed of the problem. Is it a browser problem? I try to use IE11, Google browser, Firefox browser, surfing and other mainstream browser to test the open speed, found to be as slow as the snail! Finally, the author reluctantly had to look at the API page source code, found that the page loaded with such two-way code:

<!--stylesheets--><link rel= "stylesheet" href= "Http://fonts.googleapis.com/css?family=Roboto:regular, Medium,thin,italic,mediumitalic,bold "title=" Roboto "><pre name=" code "class=" HTML "><!--JAVASCRIPT-- ><script src= "Http://www.google.com/jsapi" type= "Text/javascript" ></script>

This not only let the author think recently unable to login Google account problem, Google's browser is located abroad, so when every time you open the local Android API document will download the CSS style and JS file from the server outside of Google. As a result, the speed of opening the API page becomes particularly slow.

know the reason after the author came up with a few solutions, and share with you:

The first and most straightforward approach is to: since the Web page to download CSS styles and JS files then turn the network off so that the speed is fast.

The second method: the first method because each time you open the API Reference document to actively shut down the network, especially when using the network is not particularly convenient. Does it have a way of both worlds?

From the above source can be seen: The API page is downloaded from the http://fonts.googleapis.com/and http://www.google.com URLs, if you can let the host does not download files from these two URLs do not solve the problem! This need to use the knowledge of the network: Each host has a hosts file, which is the role of the user in the browser to enter a need to log in the URL, the system will first automatically find the corresponding IP address from the Hosts file, once found, the system will immediately open the corresponding page , if not found, then the system will submit the URL to the DNS domain name resolution server for IP address resolution. Let's do something about it on the Hosts file file:

In: File under C:\Windows\System32\drivers\etc\ The hosts add the following two sentences:
127.0.0.1 fonts.googleapis.com
127.0.0.1 www.google.com


The above two lines of code mean to tell the host http://fonts.googleapis.com/and http://www.google.com domain name corresponding IP is its own! This way, every time you open the API documentation, you don't have to download files from a foreign server!

Try not to improve a lot of speed!



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.