Specific embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the disclosure in accompanying drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure and should not be by embodiments set forth here
Limited.On the contrary, there is provided these embodiments are able to be best understood from the disclosure, and can be by the scope of the present disclosure
Complete conveys to those skilled in the art.
Before illustrating to various embodiments of the present invention, first application scenarios according to the present invention are done with briefly introduction.It is existing
Browser mostly support multi-tag function, e.g., Chrome browsers, Firefox browser, 360 browsers etc..The present invention is carried
For method be applicable on the platforms such as PC, mobile device it is various support multi-tag functions browser.
User is using a kind of typical scenario during browser, the HTML under asking same server in multiple Shipping Options Pages
The page, for example, User logs in forum opens two models with time point, asks different html files.The text of the two html files
The URL addresses of part name, i.e. model are respectively:http://bbs.abc.com/thread-517.html and http://
Bbs.abc.com/thread-516.html, it can be seen that two files are stored in same server.Another situation
It is that administrator logs in the monitoring page by browser, and in each labels page the different monitoring pages are opened, these monitoring
The page is all stored in same server.
Fig. 1 shows the schematic diagram of multiple Shipping Options Pages of browser and server communication in prior art, as shown in figure 1,
4 Shipping Options Pages for accessing same server are currently opened, each in 4 Shipping Options Pages is established with server and is connected,
Request is submitted to by the connection set up and response is received.Each connection only processes the request of 1 Shipping Options Page.Although this may make mark
Sign page and receive corresponding message quickly, however, user for example, may use to the opening time of Shipping Options Page without very high requirement
Family point is opened and open on backstage and do not switch after Shipping Options Page, and sets up multiple connections and want the resources such as repeated dispensing caching, and this can be right
The resource of terminal unit causes big expense, meanwhile, the access server by this way of the browser on substantial amounts of terminal unit,
Will also result in the waste of Internet resources.
Fig. 2 shows the flow chart of browser according to an embodiment of the invention and the method for server communication, such as Fig. 2
Shown, the method comprises the steps:
Step S210, determines main label page and assistant label page in the multiple Shipping Options Pages for accessing same server, sets up master
Communication connection between Shipping Options Page and server.
To above-mentioned situation, in the present invention, the communication connection only set up between part labels page and server.With server
The Shipping Options Page for establishing connection is referred to as main label page, and other Shipping Options Pages are assistant label page.
Firstly, it is necessary to main label page is selected from the multiple Shipping Options Pages for accessing same server, wherein, main label page can
Being one or more.For example, user opens an initial Shipping Options Page, is input into URL:http://bbs.abc.com/
Index.html, if current also without other pages of the label access to web page website, using the initial labels page as principal mark
Page is signed, afterwards, user clicks a chained address in the initial labels page:http://bbs.abc.com/thread-
5167017-1-1.html, opens a new Shipping Options Page, if should new Shipping Options Page request be HTML in same server literary
Part, using new Shipping Options Page as assistant label page.Or, randomly choose one or more main labels in the multiple Shipping Options Pages opened
Page, the present invention is not intended to limit the selection mode of main label page and assistant label page.
The embodiment of the present invention can set up communication connection using existing mode.Specifically, browser analysis link in or
The URL of user input, request domain name mapping or reading domain name caching, obtain the IP address of server, and request is set up with server
TCP connects.Server processes listening port, to have discovered whether that browser sends connection establishment request, sets up according to request
Connection.
Step S220, opens local service to set up the locality connection between main label page and assistant label page.
Here locality connection is the communication connection between different application or process.Main label page is directly with foundation
Communication connection access server, assistant label page through main label page indirectly with server communication.Main label page and assistant label page
Between information exchange carried out by locality connection.
Specifically, after main label page is determined, be switched on a local service (server), for set up main label page and
Connection between assistant label page.The local service can be provided by LocalConnection (locality connection) object, or by calling
ExterInterface interfaces are realized.
Step S230, by the communication connection between locality connection and main label page and server realize assistant label page with
Communication between server.
Fig. 3 shows the schematic diagram of multiple Shipping Options Pages of browser and server communication in the present invention.As shown in figure 3, secondary
Shipping Options Page will be sent to local service to the http request of server, such as local Flash server, wherein, Flash
Server is set up by the flash plug-in units in browser.Afterwards, the request of assistant label page is sent to main label page by local service,
Main label page sends the request by the communication connection between server.Main label page receives the response message of server
Afterwards, response message is distributed to into corresponding assistant label page further through local service.
According to the method that the above embodiment of the present invention is provided, in the multiple Shipping Options Pages for accessing same server, only set up
Communication connection between main label page and server, other Shipping Options Pages are as assistant label page by locality connection and main label page
Communication, then by main label page and server communication.According to the program, the connection quantity between browser and server is less than visit
The label number of pages of the server is asked, the cost shared of connection will be set up in the request of multiple Shipping Options Pages, reached saving money
The purpose in source.
Fig. 4 shows the flow chart of browser in accordance with another embodiment of the present invention and the method for server communication, such as
Shown in Fig. 4, method comprises the steps:
Step S410, determines main label page and assistant label page in the multiple Shipping Options Pages for accessing same server.
Alternatively, using the Shipping Options Page of first access server as main label page in the embodiment of the present invention.Newly mark when having
Sign page to open and when server submission request, for example, open link http://bbs.abc.com/thread-
During 5167017-1-1.html, check whether browser has turned on the main label page with the server communication, if it has, for example
http://bbs.abc.com/index.html, by new tab assistant label page is defined as;Otherwise, new tab is made
Based on Shipping Options Page.
Step S420, the communication connection set up between main label page and server.
Specifically, browser analysis link in or user input URL, request domain name mapping or read domain name caching, obtain
To the IP address of server, request is set up TCP and is connected with server.Server processes listening port, it is clear to have discovered whether
Device of looking at sends connection establishment request, and according to request connection is set up.Usually, carried out in the TCP connections set up in HTTP modes
Request.Http protocol is stateless, and server only returns response message according to user's request.It is higher for requirement of real-time
Situation, for example, manager opens multiple control pages and is monitored, or user carries out game on line etc., and needs constantly send please
Ask, in request message, main body proportion is again relatively low and be mostly header message, cause the utilization rate of Internet resources low.
Method provided in an embodiment of the present invention is particularly suitable for WebSocket connections, and WebSocket is one kind of HTML5
New agreement, can realize browser and server full-duplex communication.In the case of above-mentioned real-time, main label page and clothes
Business device set up after WebSocket connection establishments, connection status keep, server in real time to client push data, and without the need for visitor
Family end frequent requests.
Step S430, opens local service to set up the locality connection between assistant label page and main label page.
Specifically, two kinds of optional modes are embodiments provided for setting up between assistant label page and main label page
Locality connection.
Mode one:
The manner needs browser to be provided with Flash plug-in units.Set up using Shipping Options Page based on Flash plug-in units and assistant label page
Swf files (alternatively referred to as Flash file), are realized between main label page and assistant label page by the communication between swf files
Locality connection.Communication between two swf files is usually used LocalConnection objects and carrys out transmission information.
Main label page loads the first Flash file, using LocalConnection classes (locality connection class) first
LocalConnection (locality connection) objects are created in Flash file as the service end of local service, first
Set in LocalConnection objects method of attachment and etc. it is to be connected, the method for attachment has the connection name specified.
Assistant label page loads the second Flash file, is created in the second Flash file using LocalConnection classes
2nd LocalConnection objects as local service client, the 2nd LocalConnection object references first
Method of attachment in LocalConnection objects, communicates with the first Flash file, so as to realize main label page and assistant label
Locality connection between page.
Mode two:
The manner realizes the communication between main label page and assistant label page using ActiveX plug-in units, it is desirable to which browser is installed
There are ActiveX plug-in units.
ActiveX plug-in units can as ordinary procedure free access and control operation system local resource, can be browsed
The page in device adds be loaded in IE browser process for page invocation when needed, so as to extend page ability.It is mounted with
After ActiveX plug-in units, each Shipping Options Page is in loading page, while loading ActiveX plug-in units.
Its function can be supplied to external container window to use by ActiveX plug-in units by opening API interface mode, container
Window calls plug-in unit API and transmits relevant parameter and uses pin function;Plug-in unit can also be by open event interface, will by container
Plugin events are bound with the responsible event handling function for processing the event in container, so as to realize that plug-in unit adjusts back external container
The purpose of function.
Wherein, outside access interface (ExternalInterface interfaces) defines container and calls pin function and plug-in unit
Two methods of the function of readjustment container.Used in the page under the scene of activeX plug-in units, the page is exactly ActiveX plug-in units
Container.
Specifically, an ActiveX plug-in units are loaded in main label page, the 2nd ActiveX is loaded in assistant label page and is inserted
Part;Set up by the outside access interface of the outside access interface in an ActiveX plug-in units and the 2nd ActiveX plug-in units
Locality connection between the main label page and assistant label page.
Step S440, is assistant label page allocation identification.
Identify the request for distinguishing the transmission of assistant label page, and the response message that Differentiated Services device is returned.
Step S450, assistant label page will be sent to master to the communication request of server with the mark distributed by locality connection
Shipping Options Page.
The communication request that assistant label page sends is sent to server by step S460, main label page.
In the TCP connections set up, the communication request of assistant label page is sent to into server, each main label page can be
The multiple requests from multiple assistant label pages are sent in one TCP connection.The cost shared of connection will be set up to multiple requests, section
Resource is saved.
Step S470, the response message that main label page the reception server is returned.
Corresponding with the process in step S460, response message is returned to one or more main label pages by server.
Step S480, assistant label page is distributed to according to mark by response message.
By the way that response message is distributed to into corresponding secondary mark according to respective mark with the locality connection between assistant label page
Sign page.
Several specific embodiments of above-mentioned each step are illustrated below:
Fig. 5 a show that multiple Shipping Options Pages of the browser in one embodiment of the invention are real with one kind of server communication
The schematic diagram of mode is applied, as shown in figure 5, main label page and the same server of 3 assistant label access to web page, wherein, main label page is opened
The local services such as Flash server are opened, by setting up locality connection, main label respectively between local service and 3 Shipping Options Pages
Page, communicate in the way of described in step S450-S480 between assistant label page and server.It is and same in this embodiment
One server only sets up a connection, is conducive to saving Internet resources.
Fig. 5 b show that multiple Shipping Options Pages of the browser in the present invention in one embodiment are another with server communication
Plant the schematic diagram of embodiment.As shown in Figure 5 b, main label page 1,2 establish with server be connected respectively.The two connections are
Parallel, can simultaneously process request.In Fig. 5 a, main label page receives successively the request of assistant label page by locality connection, so
The response of the reception server successively afterwards, temporal expense may be larger.Compared with the mode in Fig. 5 a, this embodiment energy
The enough communication concurrently carried out between main label page and assistant label page simultaneously submits request to server, and Shipping Options Page is at faster speed
Complete loading.When label number of pages increases, speed and Internet resources can be taken into account using more main label pages.In addition, also
Can be dynamically selected according to the situation of main label page, as shown in phantom in FIG., assistant label page 1 can with main label page 2
Connection is set up, when the request of the process of main label page 1 is more, main label page 2 is sent the requests to.
Fig. 5 c show that multiple Shipping Options Pages of the browser in the present invention in one embodiment are another with server communication
Plant the schematic diagram of embodiment.As shown in Figure 5 c, two servers of multiple label access to web page that browser is opened, main label page 1
First server is accessed with assistant label page 1, main label page 2 and assistant label page 2 access second server, specifically access first service
The method that the mode of device and second server is all provided using the above embodiment of the present invention, repeats no more.
According to the method that the above embodiment of the present invention is provided, in the multiple Shipping Options Pages for accessing same server, only set up
Communication connection between main label page and server, other Shipping Options Pages are as assistant label page by locality connection and main label page
Communication, then by main label page and server communication.According to the program, the connection quantity between browser and server is less than visit
The label number of pages of the server is asked, the purpose for saving Internet resources has been reached.
Fig. 6 shows the structural representation of browser device according to an embodiment of the invention, as shown in fig. 6, this is clear
Device device of looking at includes:
Sort module 610, is suitable to determine main label page and assistant label page in the multiple Shipping Options Pages for accessing same server.
Main label page module 620, the communication connection being adapted to set up between main label page and server, and open local clothes
It is engaged in setting up the locality connection between main label page and assistant label page.
Assistant label page module 630, is suitable to by locality connection, and the communication connection between main label page and server with
Server communication.
Alternatively, main label page module 620 is further adapted for:Distribute a mark for each assistant label page;By assistant label
The communication request of transmission is sent to server;And the response message that the reception server is returned, response message is divided according to mark
Issue assistant label page.
Assistant label page module 630 is further adapted for:The communication request of server will be sent by locality connection with identifying
To main label page.
Alternatively, sort module 610 is further adapted for:When new tab submits request to server, check and browse
Whether device has turned on the main label page with the server communication;If so, new tab is defined as into assistant label page;Otherwise, will
New tab is used as main label page.
Alternatively, main label page module 620 is further adapted for:The first Flash file is loaded, in the first Flash file
The first local connecting object is created as the service end of local service;Assistant label page module 630 is further adapted for:Loading second
Flash file, creates the second locality connection object as the client of local service in the second Flash file;And pass through
The first Flash file and described second are set up in method of attachment in second the first local connecting object of locality connection object reference
Connection between Flash file.
Alternatively, main label page module 620 is further adapted for:An ActiveX plug-in units are loaded in main label page;Pair mark
Sign page module 630 to be further adapted for:The 2nd ActiveX plug-in units are loaded in assistant label page;
Main label page module 620 and assistant label page module 630 by the outside access interface in an ActiveX plug-in units and
The locality connection that outside access interface in 2nd ActiveX plug-in units is set up between main label page and assistant label page.
Alternatively, main label page module 620 is further adapted for:The WebSocket set up between main label page and server
Connection.
According to the browser device that the above embodiment of the present invention is provided, in the multiple Shipping Options Pages for accessing same server,
The communication connection only set up between main label page and server, other Shipping Options Pages are as assistant label page by locality connection and master
Shipping Options Page communicates, then by main label page and server communication.According to the program, the connection quantity between browser and server
Less than the label number of pages for accessing the server, the purpose for saving Internet resources has been reached.
Provided herein algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment.
Various general-purpose systems can also be used together based on teaching in this.As described above, construct required by this kind of system
Structure be obvious.Additionally, the present invention is also not for any certain programmed language.It is understood that, it is possible to use it is various
Programming language realizes the content of invention described herein, and the description done to language-specific above is to disclose this
Bright preferred forms.
In description mentioned herein, a large amount of details are illustrated.It is to be appreciated, however, that the enforcement of the present invention
Example can be put into practice in the case of without these details.In some instances, known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure and help understand one or more in each inventive aspect, exist
Above in the description of the exemplary embodiment of the present invention, each feature of the present invention is grouped together into single enforcement sometimes
In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:I.e. required guarantor
The more features of feature that the application claims ratio of shield is expressly recited in each claim.More precisely, such as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following specific embodiment are expressly incorporated in the specific embodiment, wherein each claim itself
All as the separate embodiments of the present invention.
Those skilled in the art are appreciated that can be carried out adaptively to the module in the equipment in embodiment
Change and they are arranged in one or more equipment different from the embodiment.Can be the module or list in embodiment
Unit or component are combined into a module or unit or component, and can be divided in addition multiple submodule or subelement or
Sub-component.In addition at least some in such feature and/or process or unit is excluded each other, can adopt any
Combine to all features disclosed in this specification (including adjoint claim, summary and accompanying drawing) and so disclosed
Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification is (including adjoint power
Profit is required, summary and accompanying drawing) disclosed in each feature can it is identical by offers, be equal to or the alternative features of similar purpose carry out generation
Replace.
Although additionally, it will be appreciated by those of skill in the art that some embodiments described herein include other embodiments
In included some features rather than further feature, but the combination of the feature of different embodiments means in of the invention
Within the scope of and form different embodiments.For example, in the following claims, embodiment required for protection appoint
One of meaning can in any combination mode using.
The present invention all parts embodiment can be realized with hardware, or with one or more processor operation
Software module realize, or with combinations thereof realization.It will be understood by those of skill in the art that can use in practice
Microprocessor during either digital signal processor (DSP) is to realize browser device according to embodiments of the present invention some or
The some or all functions of whole parts.The present invention is also implemented as being adapted for carrying out a part for method as described herein
The either equipment or program of device (for example, computer program and computer program) of whole.It is such to realize the present invention
Program can store on a computer-readable medium, or can have one or more signal form.Such letter
Number can download from internet website and to obtain, or provide on carrier signal, or provide in any other form.
It should be noted that above-described embodiment the present invention will be described rather than limits the invention, and ability
Field technique personnel can design without departing from the scope of the appended claims alternative embodiment.In the claims,
Any reference markss between bracket should not be configured to limitations on claims.Word "comprising" is not excluded the presence of not
Element listed in the claims or step.Word "a" or "an" before element does not exclude the presence of multiple such
Element.The present invention can come real by means of the hardware for including some different elements and by means of properly programmed computer
It is existing.If in the unit claim for listing equipment for drying, several in these devices can be by same hardware branch
To embody.The use of word first, second, and third does not indicate that any order.These words can be explained and be run after fame
Claim.
The invention discloses:
A kind of method of A1, browser and server communication, methods described includes:
Main label page and assistant label page are determined in the multiple Shipping Options Pages for accessing same server, the main label page is set up
With the communication connection between the server;
Open local service to set up the locality connection between the main label page and the assistant label page;
The pair is realized by the communication connection between the locality connection, and the main label page and the server
Communication between Shipping Options Page and the server.
A2, the method according to A1, wherein, open local service to set up the main label page and the pair described
Also include after locality connection between Shipping Options Page:Distribute a mark for each assistant label page;
The pair is realized by the communication connection between the locality connection and the main label page and the server
Communication between Shipping Options Page and the server is further included:
The assistant label page will be sent to described to the communication request of the server with the mark by locality connection
Main label page;
The communication request that the assistant label sends is sent to server by the main label page;
The response message that the main label page the reception server is returned, is distributed to the response message according to the mark
The assistant label page.
A3, the method according to A1 or A2, wherein, it is described that master is determined in the multiple Shipping Options Pages for accessing same server
Shipping Options Page and assistant label page are further included:
New tab is submitted to when asking to server, checks whether browser has turned on the principal mark with the server communication
Sign page;
If so, the new tab is defined as into assistant label page;
Otherwise, using the new tab as main label page.
A4, the method according to any one of A1-A3, wherein, the main label page is loaded with the first Flash file, institute
State assistant label page and be loaded with the second Flash file;
The unlatching local service is further included with setting up the locality connection between the main label page and assistant label page:
The first local connecting object is created in first Flash file as the service end of the local service;
The second locality connection object is created in second Flash file as the client of the local service;
Set up described by the method for attachment in the first local connecting object described in the second locality connection object reference
Connection between first Flash file and second Flash file.
A5, the method according to any one of A1-A3, wherein, it is described to open local service to set up the main label page
Further include with the locality connection between assistant label page:
An ActiveX plug-in units are loaded in the main label page, the 2nd ActiveX is loaded in the assistant label page and is inserted
Part;
Connect by the outside access of the outside access interface in an ActiveX plug-in units and the 2nd ActiveX plug-in units
The locality connection that mouth is set up between the main label page and assistant label page.
A6, the method according to A1, wherein, the communication link set up between the main label page and server is tapped into
One step is:The WebSocket connections set up between the main label page and the server.
B7, a kind of browser device, including:
Sort module, is suitable to determine main label page and assistant label page in the multiple Shipping Options Pages for accessing same server;
Main label page module, the communication connection being adapted to set up between the main label page and the server, and open
Local service is setting up the locality connection between the main label page and the assistant label page;
Assistant label page module, is suitable to by the locality connection, and between the main label page and the server
Communication connection and the server communication.
B8, the browser device according to B7, wherein, the main label page module is further adapted for:For each pair mark
Sign page and distribute a mark;The communication request that the assistant label sends is sent to into server;And the reception server return
Response message, the assistant label page is distributed to according to the mark by the response message;
The assistant label page module is further adapted for:To pass through local to the communication request of the server with the mark
Linkup transmit is to the main label page.
B9, the browser device according to B7 or B8, wherein, the sort module is further adapted for:
When new tab submits request to server, check whether browser has turned on the master with the server communication
Shipping Options Page;
If so, the new tab is defined as into assistant label page;
Otherwise, using the new tab as main label page.
B10, the browser device according to any one of B7-B9, wherein, the main label page module is further adapted for:
The first Flash file is loaded, the first local connecting object is created in first Flash file as the local service
Service end;
The assistant label page module is further adapted for:The second Flash file is loaded, is created in second Flash file
The second locality connection object is built as the client of the local service;And by the second locality connection object reference institute
State the method for attachment in the first local connecting object to set up between first Flash file and second Flash file
Connection.
B11, the browser device according to any one of B7-B9, wherein, the main label page module is further adapted for:
An ActiveX plug-in units are loaded in main label page;
The assistant label page module is further adapted for:The 2nd ActiveX plug-in units are loaded in assistant label page;
The main label page module and the assistant label page module are by the outside access in an ActiveX plug-in units
Outside access interface in interface and the 2nd ActiveX plug-in units sets up locally connecting between main label page and assistant label page
Connect.
B12, the browser device according to claim B7, wherein, the main label page module is further adapted for:Build
Vertical WebSocket connections between the main label page and the server.