Summary of the invention
The method and apparatus that embodiments of the invention provide a kind of page to load, the slow problem of page formation speed that the interface code loading due to needs when solving prior art load page causes more.
For reaching above-mentioned, embodiments of the invention adopt following technical scheme:
The method that the page loads, comprising:
Terminal is obtained instruction according to receive first, obtains interface code and the service code of display page.
Load interface code and the service code of described display page, to show described display interface.
Obtain the associated interface code of the associated page and be kept at this locality; The described associated page and described display page have linking relationship.
Described terminal is obtained instruction according to receive second, obtains the associated services code of the described associated page.
Described in described terminal loads associated services code be kept at local associated interface code, to show described associated interface.
The device that the page loads, comprising:
The first acquiring unit, for obtaining instruction according to receive first, obtains interface code and the service code of display page;
The first loading unit, for loading interface code and the service code of the described display page that described the first acquiring unit obtains, to show described display interface;
Second acquisition unit, for obtaining the associated interface code of the associated page and being kept at this locality; The described associated page and described display page have linking relationship;
The 3rd acquiring unit, for obtaining instruction according to receive second, obtains the associated services code of the described associated page;
The second loading unit, for loading the local associated interface code that is kept at that described associated services code that described second acquisition unit obtains obtains with described the 3rd acquiring unit, to show described associated interface.
The method and apparatus that the embodiment of the present invention provides a kind of page to load, terminal receives after the load instructions of current page, obtains and load the code of current page, and the common framework partial code that obtains the associated page of current page loads; After this when terminal is received the load instructions of administration page, obtain the functional module code of the associated page and load, realizing the demonstration of the associated page.Compared with prior art, when loading the code of current page, obtain in advance and load the common framework partial code of the associated page, thereby when receiving the load instructions of the associated page, show faster the associated page.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, those of ordinary skills, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
At present, the mode that terminal loads the page is: receive user's load instructions, according to load instructions, to server request response data, also load, and then show the page that user needs, there will be the data of a large amount of repeatability to load in said process.For this reason, following examples provide the load mode that can avoid occurring a large amount of repeated data loadings, so that data loading efficiency and page formation speed are improved.
Below in conjunction with drawings and Examples, describe above process in detail, and some details descriptions are in order to make those skilled in the art more understand technical scheme, advantage and the effect of the embodiment of the present invention, not in order to limit the present invention below.
As shown in Figure 1, a kind of method that the embodiment of the present invention provides page to load, comprising:
101, when terminal receives the load instructions of the described terminal loads current page of indication, obtain the code of described current page and load, to show described current page.
102, obtain with described current page have linking relationship the associated page common framework partial code and load.
For display page, common framework partial code and functional module code need to be obtained and load to terminal.Terminal receives after the load instructions that indication loads current page, obtains the code of described current page and loads on the one hand, also obtain on the other hand with current page have linking relationship the associated page common framework partial code and load.By obtaining in advance and the common framework partial code that loads the associated page, when the associated page of follow-up demonstration, needn't remove again to load this part common framework partial code, but thereby the functional module code that directly loads the associated page is realized the normal demonstration of the associated page, improved the speed that the page shows.
103, when described in terminal receives the described terminal loads of indication during the load instructions of the associated page, obtain the functional module code of the described associated page.
104, the functional module code of the associated page described in described terminal loads, to coordinate the common framework partial code of the described associated page having loaded to show the described associated page.
Instep 102, terminal has loaded the common framework partial code of the associated page, and the functional module code of the associated page ofstep 104 terminal loads, can show the whole associated page to user thus normally.
According to such scheme, describe, a kind of method that the embodiment of the present invention provides page to load, terminal receives after the load instructions of current page, obtains and load the code of current page, and the common framework partial code that obtains the associated page of current page loads; After this when terminal is received the load instructions of administration page, obtain the functional module code of the associated page and load, realizing the demonstration of the associated page.Compared with prior art, when loading the code of current page, obtain in advance and load the common framework partial code of the associated page, thereby when receiving the load instructions of the associated page, show faster the associated page.
Scheme for a better understanding of the present invention, existing describes according to above, in conjunction with the following drawings and embodiment the present invention program is further described.
As shown in Figure 2, a kind of method that the embodiment of the present invention provides page to load, comprising:
201, terminal receives load instructions.
User controls terminal, sends the load instructions that loads current page to terminal.Described terminal can be specifically desktop computer, notebook computer, the equipment that smart mobile phone etc. are Internet enabled.
202, terminal is obtained common framework partial code and the functional module code of current page.
In the embodiment scene shown in Fig. 2, the first page that described current page is terminal loads.When terminal does not have in pre-stored any page correlative code situation in this locality, terminal need to load common framework partial code and the functional module code of current page.
203, load common framework partial code and the functional module code of current page.
204, obtain the common framework partial code with current page with the associated page of linking relationship.
205, load the common framework partial code of the associated page.
In terminal, receive after load instructions, obtain and load on the one hand common framework partial code and the functional module code of current page.On the other hand, also obtain and loading and current page have the common framework partial code of the associated page of linking relationship.
206, show current page.
207, terminal receives load instructions.
The load instructions ofstep 207 is indicated the associated page described in described terminal loads.
208, obtain the functional module code of the associated page.
Becauseabovementioned steps 205 has loaded the common framework partial code of the associated page, sostep 208 is only obtained the functional module code of the associated page.
In practical operation, when user wishes to browse certain webpage, to terminal, send user operation (such as mouse clickable icon, or touch operation icon).User operation is converted to load instructions and is received by terminal, through above-mentioned 202 to 206, finally shows that user wishes the page of browsing.
209, the functional module code of the associated page described in terminal loads.
210, show the associated page.
User, when browsing current page, may open by the icon on the click page the associated page of current page.The common framework partial code of the associated page is loaded, and now terminal is only obtained the functional module code of the associated page and loaded, and then shows the associated page.
The first page that the current page that Fig. 2 describes is terminal loads.In more general situation, if current page is not the first page (being assumed to be the K page) of terminal loads, the common framework partial code of the K page is acquired and loads when loading the K-1 page, when receiving the load instructions that loads the K page, the functional module code of the K page is obtained and loaded to terminal on the one hand, thereby can show the K page, the common framework code of the K+1 page will be obtained and load to terminal also on the other hand, to prepare for subsequent user may require to show the K+1 page.
In addition, terminal records the URL(uniform resource locator) (URL, Uniform Resource Locator) of the current page showing.By URL coding is obtained to page iden-tity, and store this page iden-tity.
In the specific implementation of such scheme, terminal can create a manager process, and at least two embedded frameworks are set in manager process, referred to herein as Iframe1 and Iframe2, for loading code and logic, and generates display interface.If terminal is received load instructions, suppose all loading code not of Iframe1 and Iframe2, be now first load page.An optional embedded framework (selecting Iframe1) loads current page and is shown to user, and Iframe2 loads the common framework partial code of the associated page of current page simultaneously.If receive that afterwards another load instructions requires to load the associated page, call Iframe2 and load the functional module code of another page and show the associated page, hide the page that Iframe1 loads simultaneously.
A kind of method that the embodiment of the present invention provides the page to load, terminal receives after the load instructions of current page, obtains and load the code of current page, and the common framework partial code that obtains the associated page of current page loads; After this when terminal is received the load instructions of administration page, obtain the functional module code of the associated page and load, realizing the demonstration of the associated page.Compared with prior art, when loading the code of current page, obtain in advance and load the common framework partial code of the associated page, thereby when receiving the load instructions of the associated page, show faster the associated page.
The device that the embodiment of the present invention also provides a kind of page to load, as shown in Figure 3, comprising:
The first acquiringunit 31, when receiving the load instructions of the described terminal loads current page of indication when terminal, obtains the code of described current page.
Thefirst loading unit 32, for loading the code of described current page, to show described current page.
The first acquiringunit 31 is also for obtaining the common framework partial code with described current page with the associated page of linking relationship.
Thefirst loading unit 32 is also for loading the common framework partial code with described current page with the associated page of linking relationship.
Second acquisition unit 33, when receiving described in the described terminal loads of indication the load instructions of the associated page when terminal, obtains the functional module code of the described associated page.
Thesecond loading unit 34, for loading the functional module code of the described associated page, to coordinate the common framework partial code of the described associated page that described thefirst loading unit 32 loaded to show the described associated page.
Further, if during the first page that current page is terminal loads, the first acquiringunit 31 is specifically for obtaining common framework partial code and the functional module code of current page;
Thefirst loading unit 32 is specifically for loading common framework partial code and the functional module code of current page.
If during the K page that current page is terminal loads, the first acquiringunit 31 is specifically for obtaining the functional module code of the described K page;
Thefirst loading unit 32 is specifically for loading the functional module code of the described K page; K wherein > 1, the common framework partial code of the described K page loads when the described terminal loads K-1 page.
Further, as shown in Figure 4, this device also comprises:
Record cell 35, for recording the URL of the page of current demonstration.
Coding unit 36, encodes for the URL to described recording unit records, obtains page iden-tity.
Signstorage unit 37, the described page iden-tity obtaining for storing described coding unit.
Further, the first acquiringunit 31 is specifically for obtaining the code of current page from server.Described the first acquiringunit 31 is concrete also for obtain the common framework partial code with described current page with the associated page of linking relationship from server.Describedsecond acquisition unit 33 is specifically for obtaining the functional module code of the described associated page from server.
The device that the embodiment of the present invention provides a kind of page to load, terminal receives after the load instructions of current page, obtains and load the code of current page, and the common framework partial code that obtains the associated page of current page loads; After this when terminal is received the load instructions of administration page, obtain the functional module code of the associated page and load, realizing the demonstration of the associated page.Compared with prior art, when loading the code of current page, obtain in advance and load the common framework partial code of the associated page, thereby when receiving the load instructions of the associated page, show faster the associated page.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited to this, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion by the described protection domain with claim.