Background technology
Development along with infotech, people's live and work more and more be unable to do without cyber-net, Email, official document is examined, make a reservation, shopping etc. can use browser to realize at network easily, browser is a kind of software that operates on the subscriber computer, is used for showing the html file in Web server or the file system.
Web browser is mainly mutual by http protocol and web page server and obtain webpage, and these webpages are specified by URL, and file layout is generally HTML, and is indicated in http protocol by MIME.Can comprise a plurality of documents in the webpage, each document obtains from server respectively.Most browser itself is supported the widely form except HTML, picture formats such as JPEG, PNG, GIF, and can expand and support numerous plug-in units (plug-ins).
The multiple web pages browser refers to a kind ofly simultaneously can open a plurality of pages in a window, can switch easily between a plurality of pages, and viewing experience is good.
But the inventor finds that there is following shortcoming at least in the multiple web pages browser in the prior art in realizing process of the present invention:
If in a plurality of pages of opening, a page seemingly-dead (perhaps stuck), whole browser all can be seemingly-dead, click any button, whole browser all can not operate, if want to open the new page, can only restart browser, bring bad experience to the user like this.Wherein, the page of browser is seemingly-dead to be referred to: a state of browser, showing as the page can not refresh, and clicks the not response of any button, a kind of state that can't carry out any operation.
The reason that torpor appears in the multiple web pages browser is: under the Windows system, the multiple web pages browser has a main window and a plurality of page window, and wherein, main window is that an item is arranged on the taskbar, and minimizes, maximization, the window of X button; Page window is under main window, a plurality of page windows of opening; Be set membership between main window and a plurality of page window: in the time of mobile such as parent window (being main window), subwindow (page window) is also mobile; When parent window was hidden, subwindow was also hidden; When parent window showed, subwindow also showed together.That is to say: be message synchronization between parent window and the subwindow, such as, when parent window moves, send out a message (being about to the message synchronization of mobile this operation to subwindow) to subwindow, subwindow is also mobile simultaneously.
In this case, when subwindow place thread block, namely can not response message, parent window can be waited for the response after this subwindow is handled this message always so, if subwindow does not respond always, parent window has also blocked so, so whole browser just can't respond; That is to say, if that page has occurred is seemingly-dead (perhaps stuck or without response), then will cause whole browser seemingly-dead phenomenon to occur.
Summary of the invention
The technical problem to be solved in the present invention provides a kind of method and apparatus of multi-page browser processing messages, can be in the situation of the set membership of the main window that keeps browser and page window, when torpor appears in page window, prevent that effectively torpor from appearring in main window and whole browser.
For solving the problems of the technologies described above, embodiments of the invention provide a kind of method of multi-page browser processing messages, comprising:
Host window without computing of each page window creation for browser;
Set up the set membership between the main window of set membership between the described host window page window corresponding with it and described host window and described browser;
The message synchronization that will produce the operation of described main window is to described host window, and gives described page window by described host window with described message synchronization;
When monitoring described page window and torpor occurs, the set membership between isolated described host window and the described page window.
Wherein, described message comprises: described main window is carried out an operation, the synchronization message that produces when described page window also needs to carry out described operation.
Wherein, also comprise after the set membership between described isolated described host window and the described page window:
Be synchronized to the message of described host window for described main window, respond described main window by described host window.
Wherein, whether seemingly-dead by the described page window of a thread monitor.
Wherein, set up set membership between the main window of set membership between the described host window page window corresponding with it and described host window and described browser by Set Parent function.
Embodiments of the invention also provide a kind of device of multi-page browser processing messages, comprising:
The first creation module is used to host window without computing of each page window creation of browser;
The second creation module is used for setting up the set membership between the main window of set membership between the described host window page window corresponding with it and described host window and described browser;
Message synchronization module, the message synchronization that is used for producing the operation of described main window be to described host window, and give described page window by described host window with described message synchronization;
Monitor processing module is used for when monitoring described page window and torpor occurs the set membership between isolated described host window and the described page window.
Wherein, described message comprises: when described main window is carried out a kind of operation, and the synchronization message that produces when described page window also needs to carry out described operation.
Wherein, described monitor processing module also is used for: after the set membership between isolated described host window and the described page window, be synchronized to the message of described host window for described main window, control described host window and respond described main window.
Wherein, whether described monitor processing module is specifically seemingly-dead by the described page window of a thread monitor.
Wherein, described the second creation module is specifically set up set membership between the main window of set membership between the described host window page window corresponding with it and described host window and described browser by Set Parent function.
The beneficial effect of technique scheme of the present invention is as follows:
In the such scheme, by being host window of each page window creation of browser, and set up set membership between the main window of set membership between the described host window page window corresponding with it and described host window and described browser, torpor appears monitoring described page window, then the set membership between isolated described host window and the described page window; Like this, when the page window torpor occurs owing to the operation webpage, the message that the operation of main window is produced just can not be synchronized to page window by host window, just do not need page window to reply response message by host window to main window yet, therefore, main window does not need to have waited for the response message of page window yet again, main window also just can not be owing to the process blocking phenomenon appears in the response message of waiting for subwindow, be that main window torpor can not occur, prevented that effectively torpor from appearring in main window and whole browser, the user can also operate main window and other page window of this browser, improves user's experience.
Embodiment
For making the technical problem to be solved in the present invention, technical scheme and advantage clearer, be described in detail below in conjunction with the accompanying drawings and the specific embodiments.
As shown in Figure 2, embodiments of the invention provide a kind of method of multi-page browser processing messages, it is characterized in that, comprising:
Step 11 is host window without computing of each page window creation of browser;
Step 12 is set up the set membership between the main window of set membership between the described host window page window corresponding with it and described host window and described browser;
Step 13, the message synchronization that will produce the operation of described main window be to described host window, and give described page window by described host window with described message synchronization;
Step 14, when monitoring described page window and torpor occurs, the set membership between isolated described host window and the described page window.
Among this embodiment of the present invention, host window is the window without computing, and namely display web page does not carry out any computing about webpage, only is responsible for carrying out the synchronous transmission of the message between main window and the page window, and the synchronization message of response main window; Therefore, this host window is equally as window, but torpor can not occur.
Among this embodiment of the present invention, when the page window torpor occurs owing to the operation webpage, because the set membership between isolated described host window and the described page window, therefore, the message that the operation of main window is produced just can not be synchronized to page window by host window, does not just need page window to reply response message by host window to main window yet; Therefore, main window does not need to have waited for the response message of page window yet again, main window also just can not be owing to the process blocking phenomenon appears in the response message of waiting for subwindow, be that main window torpor can not occur, prevented that effectively torpor from appearring in main window and whole browser, the user can also operate main window and other page window of this browser, improves user's experience.
And in this embodiment of the present invention, described message comprises: described main window is carried out an operation, the synchronization message that produces when described page window also needs to carry out described operation, comprise that all carry out synchronous message between main window and page window, as to as described in the move operation of main window, the message that produces when page window also moves; To the maximum operation of described main window, the message that produces when page window also maximizes; To the operation that minimizes of described main window, message that produces when page window also minimizes etc.
Further, in another embodiment of the present invention, comprise on the basis of above-mentioned steps 11-14, also comprise after the set membership between described isolated described host window and the described page window:
Be synchronized to the message of described host window for described main window, respond described main window by described host window.Main window can be waited for the response of page window like this, also just process blocking can not occur, also just torpor can not occur, prevents that effectively torpor from appearring in whole browser, improves user's experience.
In another embodiment of the present invention, at monitoring page window whether during torpor, can whether seemingly-dead by the described page window of a thread monitor, can certainly monitor page window by alternate manner and torpor whether occur.
In another embodiment of the present invention, in the set membership of setting up between the host window page window corresponding with it, and during the set membership between host window and the main window, can set up set membership between the main window of set membership between the described host window page window corresponding with it and described host window and described browser by Set Parent function.
Specific implementation process below in conjunction with concrete application scenarios explanation the above embodiment of the present invention:
As shown in Figure 3, browser comprises a main window and several page windows (being subwindow), to open 3 page windows as example, is respectively page window 1 among the figure, page window 2 and page window 3; Be respectively page window 1 and create host window 1, for page window 2 creates host window 2, for page window 3 creates host window 3; The pass that arranges between main window and the host window 1 is set membership, and the pass between main window and the host window 2 is set membership, and the pass between main window and the host window 3 is set membership; The pass that arranges simultaneously between host window 1 and the page window 1 is set membership, and the pass that arranges between host window 2 and the page window 2 is set membership, and the pass that arranges between host window 3 and the page window 3 is set membership;
When main window is carried out move operation, can produce a message, this message can be by main window synchronously to host window 1, host window 2 and host window 3; Host window 1 can be with this message synchronization to page window 1, and host window 2 can be with this message synchronization to page window 2, and host window 3 can be with this message synchronization to page window 3; Page window 1 after page window 2 and page window 3 are received this message, can move along with the movement of main window.
In the whole process, can adopt a thread to page window 1, page window 2 and page window 3 are monitored, if find that page window 2 is when display web page, for a certain reason, torpor appears, such as operations such as can't clicking or refresh at page window 2, the i.e. thread block at these page window 2 places, this page window 2 just can not respond the message of coming synchronously by host window 2 more so;
Under the traditional approach, main window can be waited for the response of 2 pairs of these synchronization messages of this page window always, thereby the thread that main window occurs also blocks, and carries out and main window can't carry out any operation, and is namely seemingly-dead;
And among this embodiment of the present invention, when page window 2 does not respond the message of coming synchronously by host window 2, set membership between isolated this page window 2 and this host window 2, like this host window 2 just can be not again the message that main window is synchronous, be synchronized to this page window 2, just do not needed the response of page window 2 yet, so just prevented that effectively main window and other page window are owing to the seemingly-dead torpor that occurs of one of them page window;
And this embodiment of the present invention is at the main window and the host window that keep browser, and in the situation of the set membership between host window and the page window, realizes effectively preventing that main window and whole browser from occurring seemingly-dead; And then improved user's experience.
In the above-described embodiments, when page window 2 does not respond main window, synchronization message by 2 pairs of main windows of host window of these page window 2 correspondences is made response, and this host window 2 is owing to being window without computing, therefore, can not occur seemingly-deadly, main window just can not occur seemingly-dead owing to can not get response yet.
As shown in Figure 4, said method embodiment accordingly, embodiments of the invention also provide a kind of device of multi-page browser processing messages, it is characterized in that, comprising:
The first creation module 21 is used to host window without computing of each page window creation of browser;
The second creation module 22 is used for setting up the set membership between the main window of set membership between the described host window page window corresponding with it and described host window and described browser;
Message synchronization module 23, the message synchronization that is used for producing the operation of described main window be to described host window, and give described page window by described host window with described message synchronization;
Monitor processing module 24 is used for when monitoring described page window and torpor occurs the set membership between isolated described host window and the described page window.
Among this embodiment of the present invention, host window is the window without computing, and namely display web page does not carry out any computing about webpage, only is responsible for carrying out the synchronous transmission of the message between main window and the page window, and the synchronization message of response main window; Therefore, this host window is equally as window, but torpor can not occur.
Among this embodiment of the present invention, when the page window torpor occurs owing to the operation webpage, because the set membership between isolated described host window and the described page window, therefore, the message that the operation of main window is produced just can not be synchronized to page window by host window, does not just need page window to reply response message by host window to main window yet; Therefore, main window does not need to have waited for the response message of page window yet again, main window also just can not be owing to the process blocking phenomenon appears in the response message of waiting for subwindow, be that main window torpor can not occur, prevented that effectively torpor from appearring in main window and whole browser, the user can also operate main window and other page window of this browser, improves user's experience.
And in this embodiment of the present invention, described message comprises: described main window is carried out an operation, the synchronization message that produces when described page window also needs to carry out described operation, comprise that all carry out synchronous message between main window and page window, as to as described in the move operation of main window, the message that produces when page window also moves; To the maximum operation of described main window, the message that produces when page window also maximizes; To the operation that minimizes of described main window, message that produces when page window also minimizes etc.
In another embodiment of the present invention, described monitor processing module also is used for: after the set membership between isolated described host window and the described page window, be synchronized to the message of described host window for described main window, respond described main window by described host window.
In another embodiment of the present invention, whether described monitor processing module is specifically seemingly-dead by the described page window of a thread monitor.
In another embodiment of the present invention, described the second creation module is specifically set up set membership between the main window of set membership between the described host window page window corresponding with it and described host window and described browser by Set Parent function.
This device embodiment of the present invention is at the main window and the host window that keep browser equally, and in the situation of the set membership between host window and the page window, prevents that effectively main window and whole browser from occurring seemingly-dead; And then improved user's experience.
The above is preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from principle of the present invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.