Background technology
Development along with RIA (Rich Internet Applications) rich internet application technology, the framework that many scripts occurred, such as JQuery, ExtJs and Dojo, these frameworks can greatly reduce the construction cycle that the software systems front end represents layer, and provide abundant user to experience, in enterprise application software and internet works software system, be widely used, simultaneously, some enterprises also develop own framework according to the demand of self, the resource file sizes such as the script of these frameworks and the realization relative program realized with these frameworks and Cascading Style Sheet often reach hundreds thousand of bytes, even reach several megabyte, and the characteristics of these resource files are when being each access or refreshed web page, all to again download, thereby increase period of reservation of number, waste simultaneously local computer and network bandwidth resources.
In order to address the above problem, application number is 201110278365.7 patent of invention discloses a kind of fast access webpage in March, 2012 method, device and a kind of browser, its way is that all web datas are pre-loaded to local, when initiating web-page requests, use local web data, this way promotes the access speed of webpage really greatly, but abandoned simultaneously the characteristic of B/S (Browser/Server) framework of webpage, significant problem is, if the partial content of webpage is to need server according to certain service logic Dynamic Generation, what then the device of the method and correspondence and browser used is the page of client, produce without server, so can't realize this dynamic content.
Application number is that 200910238934.8 patent of invention discloses method, device and the built-in browser that a kind of script is processed in July, 2010, it judges by syntax tree whether the script that current web page uses was front using, used and then directly used local script, otherwise download from server end, and the script of downloading is kept at local for next time.This invention has reduced the chance of the identical script of repeated downloads, but will be from the server end Download Script, and the number of times of downloading depends on client-cache space and term of validity setting, and along with increasing that different web pages is accessed, same script file download time also can increase.
Same, to be 200810224605.3 patent of invention in March, 2009 also realized the script processing procedure of the patent of invention of similar application number 200910238934.8 to application number in the disclosed method, but increased the caching process of Cascading Style Sheet and image content, certainly also there are identical with it problems and shortcomings, but also have following problem:
1. when the resource content in the server changes but is used for sign and distinguishes the resource name of resource or ID and do not change, can cause client can not upgrade such content;
2. all to compare each DOM node during each loading content, for the more page of the DOM node of complexity, can take the more cpu resource of client.
Summary of the invention
The present invention proposes a kind of method, device and browser of acceleration of web page access, by the resource content in the webpage is retained in client, thereby client is when opening the webpage of network-side, do not need the resource content that existed from the network side download client again, then reduce the loading content of webpage, improve the loading velocity of webpage, strengthen the user and experience; Described resource content can be the perhaps combination of the two in the content for script, Cascading Style Sheet in the webpage.
In order to reach above-mentioned technique effect, the present invention proposes a kind of method of acceleration of web page access, comprising:
By a kind of mode, mode such as browser plug-in, installation procedure or download, resource content in the webpage is retained in client, and this resource content is related with browser or browser component, make webpage when needs use this resource content, directly use the resource content of client, and needn't download these resource contents from network side again; Simultaneously, for the resource content that guarantees client keeps up-to-date version, browser or browser component are before loading the client resource content, whether by Network Check active client resource content need upgrading, if the resource content of the upgrading updating content client that provides by network side is provided then if also needing.
According to the method for above-mentioned acceleration of web page access, the present invention proposes a kind of device of acceleration of web page access, comprising:
Resource module is used for management and bearing resource content, can resource content be retained in client by it;
Initialization module for the resource content of client is related with browser or the browser component of client, makes webpage can directly use the resource content of client;
Whether the upgrading module needs upgrading for detection of the client resource content, if, the resource content of the upgrading updating content client that then provides by network side.
By the device of above-mentioned acceleration of web page access, the present invention proposes a kind of browser of acceleration of web page access, and this browser has also used the device of above-mentioned acceleration of web page access except the function that possesses generic browser.
Embodiment
Clearer for what purpose of the present invention, technical scheme and advantage were expressed, be described in further details again below by specific embodiment.
" this locality " of below mentioning is equivalent to " client ".
Consider in conjunction with acceleration of web page visit to device and browser illustrate that the method for acceleration of web page access of the present invention can be more straightforward, give unnecessary details in order to reduce simultaneously, present embodiment is at first realized the device of acceleration of web page access, then realize a browser with this device, the method for accessing by the operating process explanation acceleration of web page of browser again.
Use resource content in following examples and comprise content for script and Cascading Style Sheet content.
The device of acceleration of web page access.
Please refer to Fig. 1, the device 4 of acceleration of web page access has comprised resource module 41, initialization module 42 and upgrading module 43.
Wherein resource module 41 can have three kinds of implementations, first kind of way, content for script and Cascading Style Sheet content are built in the program that realizes this device as character string independently, preserve with string variable, by script attribute and the Cascading Style Sheet attribute interface as extraneous access resources content, when extraneous access script attribute or Cascading Style Sheet attribute, corresponding its corresponding string variable value of access then.
The second implementation of resource module 41, that content for script and Cascading Style Sheet content composition local file are preserved, by script attribute and the Cascading Style Sheet attribute interface as extraneous access resources content, when extraneous access script attribute or Cascading Style Sheet attribute, corresponding its corresponding file content of access then.
In order to strengthen the security of local content for script, prevent the people for distorting, can increase the encrypt and decrypt function on the basis of the second implementation of resource module 41, so that be kept at the content of local content for script for encrypting.This is the third implementation of resource module 41.
Initialization module 42 provides an external interface, and its return results is one or more content for script or Cascading Style Sheet content.
Upgrading module 43 provides an external interface, and this interface then checks by the interconnection network side whether the local resource content needs upgrading when being called, if, the local resource content that the upgrading updating content that then provides by network side is corresponding.
The browser of acceleration of web page access.
Please refer to Fig. 2, the browser 1 of realizing is comprised of the device 4 of browser user interface 2, browser kernel 3 and acceleration of web page access.
Wherein browser user interface 2 provides URL address input and the browser interface function of routine such as refreshes and carry out alternately with the function that browser kernel 3 provides; Browser kernel 3 can be the browser kernel of increasing income of commonly using, such as Webkit, realize webpage parsing, play up and the functions such as execution of script.
After browser 1 was unlocked, browser 1 called the upgrading module interface that the device 4 of acceleration of web page access provides.
After the user is by browser 1 input URL, browser 1 calls the initialization interface that the initialization module 43 in the device 4 of acceleration of web page access provides, resource content is loaded into the webpage from this locality, then load webpage corresponding to URL, and finish the follow-up page by browser kernel 3 and deal with the work, comprise and play up, carry out script etc.
The method of acceleration of web page access.
Please refer to Fig. 3, we illustrate the implementation procedure of the method for acceleration of web page access by the browser of realizing with foregoing.
Step 1: browser brings into operation.
Step 2: call the upgrading module interface, refer to that browser calls the upgrading module interface that the device of acceleration of web page access provides.
Step 3: the interconnection network side detects, and the upgrading module interface will check whether the local resource content needs upgrading by the interconnection network side.
Step 4: if need upgrading, then execution in step 5, otherwise execution in step 6.
Step 5: by network side updating content local content, refer to the upgrading content by providing from network side, the resource content that upgrading is local.
Step 6: the user inputs the URL address, refers to the user by the web page address of browser input needs access, after the affirmation, and execution in step 7.
Step 7: call the initialization module interface, refer to that browser calls the initialization module interface that the device of acceleration of web page access provides.
Step 8: return the local resource content, refer to that the initialization module interface in the device of acceleration of web page access returns local resource content.
Step 9: resource content is written into webpage, refers to that the resource content that browser returns step 8 is written in webpage corresponding to URL.
Step 10: the downloading web pages content, refer to URL address and other correlation parameters are passed to browser kernel, browser kernel is from network side downloading web pages content.
Step 11: by the browser kernel displayed web page, refer to that browser kernel is by the web page contents of downloading and the resource content displayed web page that is written into.
Step 12: finish, procedure finishes.
The realization of method, device or browser by the access of above acceleration of web page, resource content in the webpage can be retained in client, thereby client is when opening the webpage of network-side, do not need the resource content that existed from the network side download client again, then reduce the loading content of webpage, improve the loading velocity of webpage, strengthen the user and experience.
The above only is preferred embodiment of the present invention, and is in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.