CN105306341B - Message sending device and receiving device and method and system in browser - Google Patents

Message sending device and receiving device and method and system in browser Download PDF

Info

Publication number
CN105306341B
CN105306341B CN201510624780.1A CN201510624780A CN105306341B CN 105306341 B CN105306341 B CN 105306341B CN 201510624780 A CN201510624780 A CN 201510624780A CN 105306341 B CN105306341 B CN 105306341B
Authority
CN
China
Prior art keywords
message
web page
browser
domain
source web
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201510624780.1A
Other languages
Chinese (zh)
Other versions
CN105306341A (en
Inventor
韩学斌
黄欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201510624780.1A priority Critical patent/CN105306341B/en
Publication of CN105306341A publication Critical patent/CN105306341A/en
Application granted granted Critical
Publication of CN105306341B publication Critical patent/CN105306341B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/08Annexed information, e.g. attachments
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses the message sending devices in a kind of browser comprising: standard message transmitter is sent to target webpage by the message of the source web page to be sent of message mode between domain;First judging device, it determines whether browser supports message transfer mechanism between domain, between determining that browser supports domain when message transfer mechanism, the messaging of source web page to be sent is to standard message transmitter, when the first judging device determines that current browser does not support message transfer mechanism between domain, the messaging of source web page to be sent is to customizing message sender;And customization message sender, target webpage is sent to by modifying the message of particular attribute-value source web page to be sent of target webpage.In addition, the present invention also provides a kind of message methods.Correspondingly, the present invention also provides a kind of message reception facility and methods, the communication system and method for a kind of browser.

Description

Message sending device and receiving device and method and system in browser
It is on October 19th, 2012 that the application, which is the applying date, and application number is 201210401336.X, and title is " in browser Message sending device and receiving device and method and system " application for a patent for invention divisional application.
Technical field
The present invention relates to network technique fields, and in particular to a kind of message sending device and method in a browser disappears Cease receiving device and method and communication system and method in browser.
Background technique
Nowadays, in order to strengthen the performance capabilities of Web page, many browsers are had begun using HTML5 technology.HTML5 Technology is a set of technical combinations including previous HTML, CSS and JavaScript.
JavaScript is a kind of front end dynamic script technology being commonly used in Web exploitation.In JavaScript, There is a critically important safety limitation, referred to as " Same-Origin Policy " (origin policy).This strategy for The content of pages that JavaScript code is able to access that has done critically important limitation, i.e. JavaScript can only be accessed and comprising it Content of the document under same domain.
This security strategy of JavaScript seems outstanding when carrying out more iframe or multiwindow programming and Ajax is programmed It is important.According to this strategy, such as the JavaScript code for including in the page under baidu.com domain name, Bu Nengfang Ask the content of pages under google.com domain name;The page between even different subdomain names can not pass through JavaScript Code accesses mutually.Influence for Ajax is, is requested by the Ajax that XMLHttpRequest is realized, cannot be to different Request is submitted in domain, for example, the page at abc.example.com, cannot submit Ajax request to def.example.com, Etc..
However, inevitably need to carry out cross-domain operation when some comparisons of progress deep front end programming, this When " origin policy " just seem excessively harsh.
Currently, HTML5 introduces message transfer mechanism between a new domain to solve the problems, such as cross-domain communication PostMessage, postMessage allow the communication between multiple iframe or window in the page.Some browsers are Make not support HTML5 also, but also message transfer mechanism between this domain is introduced into browser.However, not currently being All browsers all support HTML5 standard, such as IE6 and IE7 etc. not to support HTML5 not only, nor support this net Message between domains transmission mechanism.Therefore postMessage message transfer mechanism cannot be used by IE6, IE7 of Zhan Bu bazaar market share To carry out cross-domain communication.
Therefore, it is necessary to one kind it is contemplated that the incompatibility of browser and reliably carry out the skill of webpage cross-domain communication Art.
Summary of the invention
In view of the above problems, it proposes on the present invention overcomes the above problem or at least be partially solved in order to provide one kind State the message sending device of problem and the communication system and communication means of method, message reception facility and method and browser.
According to one aspect of the present invention, a kind of message sending device is provided, source web page will be come from a browser Message to target webpage send.The message sending device includes customization message sender, and the customization message sender is by repairing The particular attribute-value that changes target webpage and the message of source web page to be sent is sent to target webpage.
Optionally, message sending device of the invention further include: standard message transmitter is sent by net message between domains The message of mode source web page to be sent is sent to target webpage;And first judging device, determine whether browser is supported Message transfer mechanism between domain, between determining that browser supports domain when message transfer mechanism, source web page to be sent disappears Breath is sent to standard message transmitter, between the first judging device determines that the browser does not support domain when message transfer mechanism, The messaging of source web page to be sent is to the customization message sender.
According to another aspect of the present invention, a kind of message method is provided, source web page will be come from a browser Message to target webpage send, the message method comprising steps of by modification target webpage particular attribute-value general The message for the source web page to be sent is sent to target webpage.
Optionally, message method of the invention further includes following steps: determining whether browser is supported to disappear between domain Cease transmission mechanism;Between determining that the browser supports domain when message transfer mechanism, the message of source web page to be sent is logical The message for crossing message mode source web page to be sent between domain is sent to target webpage;And when the judgement browser When not supporting message transfer mechanism between domain, the particular attribute-value source to be sent by modifying target webpage is utilized The message of webpage is sent to target webpage to send message.
According to another aspect of the invention, the present invention provides a kind of message reception facility, in a browser from target network Page receives the message from source web page, which includes: customization message receiver, regular check target webpage Whether particular attribute-value changes, if the particular attribute-value changes, handles the particular attribute-value to be come From the message of source web page.
Optionally, message reception facility of the invention further include: standard message receiver, with message receiver between domain Formula receives the message from source web page;With the second judging device, determine whether browser supports message transfer mechanism between domain, Between determining that browser supports domain when message transfer mechanism, the message from the source page is received by standard message receiver, Between the second judging device determines that the browser does not support domain when message transfer mechanism, come from by the reception of customization message receiver The message of the source page.
According to another aspect of the invention, the present invention provides a kind of message receival method, makes the target network in browser Page receives the message from source web page, and the message receival method is comprising steps of the particular attribute-value of regular check target webpage is It is no to change, if particular attribute-value changes, the particular attribute-value is handled to obtain the message from source web page.
Optionally, message receival method of the invention further includes following steps: determining whether browser is supported to disappear between domain Cease transmission mechanism;Between determining that browser supports domain when message transfer mechanism, come with message receiving mode between domain to receive From the message of source web page, and between determining that the browser does not support domain when message transfer mechanism, regular check target network Whether the particular attribute-value of page changes, if particular attribute-value changes, handles the particular attribute-value to be come From the message of source web page.
According to another aspect of the invention, the present invention provides a kind of communication system of browser, is used for source web page and mesh The communication between webpage is marked, wherein source web page and target webpage respectively include message sending device of the invention noted earlier;With And mentioned-above message reception facility of the invention.
In accordance with a further aspect of the present invention, the present invention provides a kind of communication means of browser, is used for source web page and mesh The communication between webpage is marked, which includes: mentioned-above message method of the invention;And it is mentioned-above Message receival method of the invention.
Using the present invention, the browser of message transfer mechanism between the domain for not supporting HTML5 standard to be proposed can be made Also it can be realized cross-domain communication.In addition, the present invention is safer, can transmit mass data type, and using simple.
The above description is only an overview of the technical scheme of the present invention, in order to better understand the technical means of the present invention, And it can be implemented in accordance with the contents of the specification, and in order to allow above and other objects of the present invention, feature and advantage can It is clearer and more comprehensible, the followings are specific embodiments of the present invention.
Detailed description of the invention
By reading the following detailed description of the preferred embodiment, various other advantages and benefits are common for this field Technical staff will become clear.The drawings are only for the purpose of illustrating a preferred embodiment, and is not considered as to the present invention Limitation.And throughout the drawings, the same reference numbers will be used to refer to the same parts.In the accompanying drawings:
Fig. 1 shows the block diagram of the message sending device in browser according to an embodiment of the present invention;
Fig. 2 shows the flow charts of the message method of browser according to an embodiment of the present invention;
Fig. 3 shows the block diagram of the message reception facility in browser according to an embodiment of the present invention;
Fig. 4 shows a kind of flow chart of the message receival method of the browser of embodiment according to the present invention;
Fig. 5 shows a kind of block diagram of the communication system of the browser of embodiment according to the present invention;And Fig. 6 is shown A kind of flow chart of the communication means of the browser of embodiment according to the present invention.
Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawing Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure It is fully disclosed to those skilled in the art.
It is specific with reference to the accompanying drawing to introduce the present invention.
Fig. 1 shows the block diagram of the message sending device in a kind of browser of embodiment according to the present invention.This disappears Sending device is ceased to be used to send the message of source web page to target webpage.As shown in Figure 1, message sending device 100 includes first Judging device 110, standard message transmitter 120 and customization message sender 130.
First judging device 110 determines whether browser supports message transfer mechanism between domain, such as HTML5.It is clear when determining When device of looking at supports message transfer mechanism between domain, the messaging of source web page to be sent to standard message transmitter 120;When When first judging device 110 determines that current browser does not support message transfer mechanism between domain, the message of source web page to be sent It is sent to customization message sender 130.
Standard message transmitter 120 is sent to by the message of the message mode source web page to be sent between domain Target webpage.For example, the mode that HTML5 takes postMessage to apply sends message.With the javascript generation in HTML5 For code, if necessary to send message to target webpage, standard message transmitter 120 can use following code to carry out:
windowObject.postMessage(data,'*');
Wherein, windowObject indicates the window object of target webpage;Data indicates source web page information to be sent, can Message is sent to call directly postMessage.
It customizes message sender 130 and passes through the message of the particular attribute-value source web page to be sent of modification target webpage It is sent to target webpage.Wherein, the particular attribute-value for indicating the transmission of net message between domains can be the name attribute of window object The attribute value of value or other attributes, is also possible to the attribute value of more than two attributes.
By taking javascript code as an example, if necessary to send message to target webpage, customization message sender 130 can be with It is carried out using following code:
WindowObject.name=data;
Wherein windowObject indicates the window object of target webpage;Data indicates source web page information to be sent, fixed Message generator 130 processed realizes that message is sent out by the way that the name attribute value of modification target pages window object is message to be sent It send.
The message sending device 100 in browser shown in FIG. 1 both can be used for source web page above and target webpage is located at The situation of identical URL/domain, and can be used for source web page and target webpage is located at the situation of different URL/domains.For example, source web page It can be the different web pages in the same domain abc.example.com with target webpage, can also be to be located at source web page The webpage of abc.example.com and target webpage are the webpages positioned at def.example.com.
Further optionally, the message sending device 100 in the browser of Fig. 1 can only include customization message sender 130.No matter whether target webpage supports message transfer mechanism between domain, such as HTML5.Customization message sender 130 all passes through Modify target webpage particular attribute-value (such as name attribute value of window object) and the message of source web page to be sent It is sent to target webpage.
Fig. 2 shows a kind of flow charts of the message method 200 of the browser of embodiment according to the present invention.Such as Shown in Fig. 2, which starts from step S205, then, in step S210, determines whether browser supports domain Between message transfer mechanism, such as HTML5, between determining that browser supports domain when message transfer mechanism, this method is entered step S220, wherein message of the message of source web page to be sent by the message mode source web page to be sent between domain It is sent to target webpage.For example, the mode that source web page can take postMessage to apply sends message to target webpage.When Between step S210 determines that current browser does not support domain when message transfer mechanism, then this method enters step S230, wherein Message by modifying the particular attribute-value source web page to be sent of target webpage is sent to target webpage.Target webpage Particular attribute-value can be the name attribute value of window object or the attribute value of other attributes, be also possible to more than two The attribute value of attribute.After step S220 or step S230, message method of the invention is terminated with step S235.
In message method 200 in browser shown in fig. 2 above, source web page and target webpage can be located at phase With URL/domain or positioned at different URL/domains.For example, the two can be located at the difference in the same domain abc.example.com Webpage, can also be with source web page positioned at abc.example.com webpage and target webpage positioned at def.example.com Webpage.
Further optionally, the message method in browser shown in Fig. 2 can only include step: by modifying mesh The message for marking the particular attribute-value source web page to be sent of webpage is sent to target webpage.In this embodiment, no matter Whether target webpage supports message transfer mechanism between domain, all by modifying the particular attribute-value of target webpage for source web page Message is sent to target webpage.
Fig. 3 shows the block diagram of the message reception facility 300 in a kind of browser of embodiment according to the present invention.Disappear Breath receiving device 300 makes target webpage receive the message from source web page.As shown in figure 3, message reception facility 300 includes second Judging device 310, standard message receiver 320 and customization message receiver 330.
Second judging device 310 determines whether browser supports message transfer mechanism between domain.When the second judging device 310 determines Between browser support domain when message transfer mechanism, the message from the source page is received by standard message receiver 320;When When two judging devices 310 determine that current browser does not support message transfer mechanism between domain, the customization reception of message receiver 330 is come from The message of the source page.
Standard message receiver 320 receives the message from source web page with the message receiving mode between domain.For example, source Webpage and target webpage support the transmission of net message between domains, then standard message receiver 320 can be taken opposite with postMessage The mode answered receives the message from source web page.
By taking javacript code as an example, standard message receiver 320 receives message in the following manner:
Wherein, function of the wan360.xdomain.handler to handle received message.It is received in standard message In device 320, when it receives a message, corresponding event can be triggered (according to different browser versions, it may be possible to message Event or onmessage event), the event is monitored by being registered as wan360.xdomain.handler, when webpage is received When to message, corresponding event can be triggered, and the wan360.xdomain.handler of monitor event will receive the message simultaneously It is handled.
Whether the particular attribute-value of customization 330 regular check target webpage of message receiver changes, if specified genus Property value changes, then handles the particular attribute-value to obtain the message from source web page.Wherein, the particular attribute-value of webpage can Think the name attribute value of window object or the attribute value of other attributes, is also possible to the attribute of more than two attributes Value.
By taking javacript code as an example, customization message receiver 330 receives message in the following manner:
In the above example, cb is the function for handling message, by periodically going the name value for checking window object to be It is no change or whether be it is empty, when name value changes, illustrate to have received message, at this moment can be handled by cb The message.
Optionally, message reception facility 300 shown in Fig. 3 can also include message processing device (such as in above example Cb), processing by standard message receiver 320 and customization message receiver 330 the received message from source web page.It can Selection of land, the message processing device are independently of message reception facility 300 and are arranged.
Optionally, standard message receiving device 320 includes: monitor 3210, is monitored whether from the message of source web page; It triggers when there is the message from source web page with trigger 3210 and receives the message.
Optionally, customization message receiver 330 includes timer 3310, the particular attribute-value of regular check target webpage Whether change and is not sky.
The message reception facility 300 in browser shown in Fig. 3 both can be used for source web page above and target webpage is located at The situation of identical URL/domain, can be used for source web page and target webpage is located at the situation of different URL/domains.For example, source web page It can be the different web pages in the same domain abc.example.com with target webpage, can also be to be located at source web page The webpage of abc.example.com and target webpage are the webpages positioned at def.example.com.
Further optionally, the message sending device 300 in browser shown in Fig. 3 can only include customization message sink Device 330.No matter whether target webpage supports message transfer mechanism between domain, such as HTML5, customization message receiver 330 all fixed When check target webpage particular attribute-value whether change, if particular attribute-value changes, handle the specified genus Property value is to obtain the message from source web page.
Fig. 4 shows a kind of flow chart of the message receival method 400 of the browser of embodiment according to the present invention, uses In make target webpage receive the message from source web page.As shown in figure 4, the message receival method 400 starts from step S405, with Afterwards, in step S410, determine whether browser supports message transfer mechanism between domain, for example whether supporting HTML5.It is clear when determining Between device of looking at support domain when message transfer mechanism, S420 is thened follow the steps, is come from the message receiving mode between domain to receive The message of source web page.It is received using corresponding mode from source web page for example, target webpage can be taken with postMessage Message.In step S410, when determining that current browser does not support message transfer mechanism between domain, then this method is entered step S430, wherein whether the particular attribute-value of regular check target webpage changes, if particular attribute-value changes, locates The particular attribute-value is managed to obtain the message from source web page.Wherein, the particular attribute-value of webpage can be window object The attribute value of name attribute value or other attributes is also possible to the attribute value of more than two attributes.
Can directly it be terminated after step S420 or step S430 with step S445, optionally, in step S420 or step After rapid S430, message receival method 400 can also include step S440, wherein handle the disappearing from source web page received Breath, for being shown in target webpage.Then, then with step S445 terminate.
The message receival method in browser shown in Fig. 4 both can be used for source web page and target webpage positioned at identical above URL/domain situation, can be used for source web page and target webpage be located at the situation of different URL/domains.For example, source web page and mesh Mark webpage can be the different web pages in the same domain abc.example.com, can also be to be located at source web page The webpage of abc.example.com and target webpage are the webpages positioned at def.example.com.
Fig. 5 shows a kind of block diagram of the communication system 500 of the browser of embodiment according to the present invention, is used for source Communication between webpage and target webpage.As shown in figure 5, the communication system 500 of browser of the invention includes shown in Fig. 1 Message reception facility 300 shown in message sending device 100 and Fig. 3.Wherein, message sending device 100 includes shown in Fig. 1 The first judging device 110, standard message transmitter 120 and customization message sender 130.Message reception facility 300 includes Fig. 1 Shown in the second judging device 310, standard message receiver 320 and customization message receiver 330.
Specifically, the first judging device 110 in message sending device 100 determines whether browser supports net message between domains to pass Defeated mechanism, such as HTML5.Between determining that browser supports domain when message transfer mechanism, the message of source web page to be sent It is sent to standard message transmitter 120.Standard message transmitter 120 is by the message of source web page with the message mode between domain It is sent to the second judging device 310 of message reception facility 300.Second judging device 310 determines whether browser is supported to disappear between domain Transmission mechanism is ceased, between determining that browser supports domain when message transfer mechanism, the source of coming from is received by standard message receiver 320 The message of the page.
Between the first judging device 110 determines that browser does not support domain when message transfer mechanism, source web page to be sent Messaging to customization message sender 130.It customizes message sender 130 and passes through the particular attribute-value of modification target webpage The message of source web page to be sent is sent to the second judging device 310 of message reception facility 300, and the second judging device 310 determines Whether browser supports message transfer mechanism between domain, between determining that browser does not support domain when message transfer mechanism, by fixed Whether the particular attribute-value of 330 regular check target webpage of message receiver processed changes, if particular attribute-value becomes Change, then handles the particular attribute-value to obtain the message from source web page.
Optionally, the communication system of browser of the invention can also include message handling device 510.Message handling device 510 Handle the 330 received message of institute of standard message receiver 320 or customization message receiver.
The communication system 500 of browser of the invention both can be used for source web page and target webpage is located at identical URL/domain Situation, and can be used for source web page and target webpage is located at the situation of different URL/domains.For example, source web page and target webpage It can be the different web pages being located in the same domain abc.example.com, can also be to be located at source web page The webpage of abc.example.com and target webpage are the webpages positioned at def.example.com.
Further optionally, the message sending device 100 in the communication system 500 of browser of the invention can only include Message sender 130 is customized, correspondingly, message reception facility 300 can only include customization message sender 330.In this feelings Under shape, no matter whether target webpage supports net message between domains to transmit, and customization message sender 130 all passes through modification target webpage Particular attribute-value (such as name attribute value of window object) and the message of source web page to be sent is sent to target webpage, Correspondingly, whether the particular attribute-value for customizing all regular check target webpages of message receiver 330 changes, if specified genus Property value changes, then handles the particular attribute-value to obtain the message from source web page.
In addition, the communication system 500 of browser of the invention can be as described above, message sending device 100 therein be set It is placed in source web page, and message reception facility 300 is set in target webpage, so that target webpage can always receive to come From the message of source web page.But the communication system 500 of browser of the invention is not limited to this, in source web page and target webpage all It can both include message sending device 100, also include message reception facility 300, so that any one webpage all can both have been sent Message also can receive message.
It is said in more detail below by communication system 500 of the specific example to browser of the invention It is bright.
In this example embodiment, the communication system 500 of browser of the invention makes a webpage being located in the first domain a.com Cross-domain communication is carried out between webpage child.html in parent.html and its second domain b.com being embedded in by iframe. Wherein, the webpage parent.html in the first domain is source web page, and the webpage child.html in the second domain is known as target webpage.
Webpage parent.html in first domain has message sending device 100, by sendMessage be responsible for Target webpage sends message.Webpage child.html in second domain has message reception facility 300 and message handling device 510, Message reception facility 300 is responsible for receiving the message that sends over of source web page and message is transferred to message handling device by monitoring 510 are handled.
Message sending device 100 has the first judging device 110, standard message transmitter 120 and customization message sender 130.Wherein the first judging device 110 judges whether browser supports HTML5, such as Firefox, IE8+, Opera, Safari, Chrome is the browser for supporting HTML5, and IE6 and IE7 is the browser for not supporting HTML5.When judgement browser is supported When HTML5, standard message transmitter 120 sends a message to target webpage by the postMessage function of HTML5, otherwise, It customizes message sender 130 and message is sent to target webpage by the name attribute of the window object in modification target webpage.
Message reception facility 300 includes the second judging device 310, standard message receiver 320 and customization message receiver 330.Wherein, the second judging device 310 judges whether browser supports HTML5, if it is decided that browser supports HTML5, then standard Message receiver 320 passes through addEventListener or attachEvent (supporting situation selection depending on browser) addition message Monitoring event, such as it is an event that source web page, which carrys out message, obtains the message of source web page transmitting by event triggering, then will disappear Breath is given message handling device 510 and is handled;Otherwise, message receiver 330 is customized by the window of timing probe target webpage The name attribute value of object obtains the message that the source page is sent, then gives when name attribute value changes and is not empty Message handling device 510 is handled.In addition, the present invention also provides a kind of a kind of browsers of embodiment according to the present invention The flow chart of communication means 600, as shown in fig. 6, it is used for the communication between source web page and target webpage.The communication of the browser Then method executes message method shown in Fig. 2, executes message sink shown in Fig. 4 later such as in step S605 Then method terminates the communication means with step S665.About aforementioned messages sending method referring specifically to being previously with regard to retouching for Fig. 2 It states, such as aforementioned messages method of reseptance referring specifically to description as described in being previously with regard to Fig. 4, description is not repeated herein.
In summary, in order to realize that the Web page (hereinafter referred to as " source web page ") of browser for using HTML5 passes through with it Cross-domain communication between the Web page (hereinafter referred to as " target webpage ") of the not same area of iframe insertion, the present invention first determine whether Whether target webpage supports HTML5, if supporting HTML5, is answered using message mode, that is, postMessage of HTML5 With being communicated, if not supporting HTML5, the hair of message is completed by the name attribute of modification target webpage window object It send, and target webpage is then by judging whether the value of the name attribute of window object changes or whether to be sky judge Whether message is received, it is possible thereby to realize the cross-domain communication between the not Web page of same area.
Algorithm and display are not inherently related to any particular computer, virtual system, or other device provided herein. Various general-purpose systems can also be used together with teachings based herein.As described above, it constructs required by this kind of system Structure be obvious.In addition, the present invention is also not directed to any particular programming language.It should be understood that can use various Programming language realizes summary of the invention described herein, and the description done above to language-specific is to disclose this hair Bright preferred forms.
In the instructions provided here, numerous specific details are set forth.It is to be appreciated, however, that implementation of the invention Example can be practiced without these specific details.In some instances, well known method, structure is not been shown in detail And technology, so as not to obscure the understanding of this specification.
Similarly, it should be understood that in order to simplify the disclosure and help to understand one or more of the various inventive aspects, Above in the description of exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes In example, figure or descriptions thereof.However, the disclosed method should not be interpreted as reflecting the following intention: i.e. required to protect Shield the present invention claims features more more than feature expressly recited in each claim.More precisely, 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 a separate embodiment of the present invention.
Those skilled in the art will understand that can be carried out adaptively to the module in the equipment in embodiment Change and they are arranged in one or more devices different from this embodiment.It can be the module or list in embodiment Member or component are combined into a module or unit or component, and furthermore they can be divided into multiple submodule or subelement or Sub-component.Other than such feature and/or at least some of process or unit exclude each other, it can use any Combination is to all features disclosed in this specification (including adjoint claim, abstract and attached drawing) and so disclosed All process or units of what method or apparatus are combined.Unless expressly stated otherwise, this specification is (including adjoint power Benefit require, abstract and attached drawing) disclosed in each feature can carry out generation with an alternative feature that provides the same, equivalent, or similar purpose It replaces.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments In included certain features rather than other feature, but the combination of the feature of different embodiments mean it is of the invention Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed Meaning one of can in any combination mode come using.
Various component embodiments of the invention can be implemented in hardware, or to run on one or more processors Software module realize, or be implemented in a combination thereof.It will be understood by those of skill in the art that can be used in practice Microprocessor or digital signal processor (DSP) realize one of some or all components according to embodiments of the present invention A little or repertoire.The present invention is also implemented as setting for executing some or all of method as described herein Standby or program of device (for example, computer program and computer program product).It is such to realize that program of the invention deposit Storage on a computer-readable medium, or may be in the form of one or more signals.Such signal can be from because of spy It downloads and obtains on net website, be perhaps provided on the carrier signal or be provided in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and ability Field technique personnel can be designed alternative embodiment without departing from the scope of the appended claims.In the claims, Any reference symbol between parentheses should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not Element or step listed in the claims.Word "a" or "an" located in front of the element does not exclude the presence of multiple such Element.The present invention can be by means of including the hardware of several different elements and being come by means of properly programmed computer real It is existing.In the unit claims listing several devices, several in these devices can be through the same hardware branch To embody.The use of word first, second, and third does not indicate any sequence.These words can be explained and be run after fame Claim.
The invention discloses:
A1, a kind of message sending device should suitable in a browser sending the message from source web page to target webpage Message sending device includes:
Message sender is customized, the message of the particular attribute-value source web page to be sent by modifying target webpage It is sent to target webpage.
A2, message sending device as described in a1, further include:
Standard message transmitter is sent to mesh by the message of the source web page to be sent of message mode between domain Mark webpage;And
First judging device, determines whether the browser supports message transfer mechanism between domain, when the judgement browsing When device supports message transfer mechanism between domain, the messaging of source web page to be sent to the standard message transmitter, when When first judging device determines message transfer mechanism between the browser does not support domain, the messaging of source web page to be sent To the customization message sender.
A3, message sending device as described in a1 or a2, wherein source web page and target webpage belong to different URL/domains.
A4, the message sending device as described in any one of A1-A3, wherein the particular attribute-value is window couples The name attribute value of elephant.
B5, a kind of message method, for the message from source web page to be sent to target webpage in a browser, packet Include step:
Message by modifying the particular attribute-value source web page to be sent of target webpage is sent to target webpage.
B6, the message method according to B5, further comprise the steps of:
Determine whether browser supports message transfer mechanism between domain,
Between determining that the browser supports domain when message transfer mechanism, the message of source web page to be sent passes through net The message of message between domains sending method source web page to be sent is sent to target webpage, and
Between determining that the browser does not support domain when message transfer mechanism, using described by modifying target webpage Particular attribute-value and the message of source web page to be sent is sent to target webpage to send message.
B7, the message method according to B5 or B6, wherein source web page and target webpage belong to different URL/domains.
B8, the message method according to any one of B5-B7, wherein the particular community of the target webpage Value is the name attribute value of window object.
C9, a kind of message reception facility, suitable for receiving the message from source web page from target webpage in a browser, this disappears Ceasing receiving device includes:
Message receiver is customized, whether the particular attribute-value of regular check target webpage changes, if the spy Determine attribute value to change, then handles the particular attribute-value to obtain the message from source web page.
C10, the message reception facility according to C9, further includes:
Standard message receiver receives the message from source web page with message receiving mode between domain;With
Second judging device, determines whether the browser supports message transfer mechanism between domain, when the judgement browsing Between device support domain when message transfer mechanism, the message from the source page is received by the standard message receiver, when second When judging device determines message transfer mechanism between the browser does not support domain, received by the customization message receiver from source The message of the page.
C11, the message reception facility as described in C9 or C10, wherein the source web page and the target webpage belong to difference URL/domain.
C12, the message reception facility according to any of C9-C11, wherein
The standard message receiver includes:
Monitor is monitored whether from the message of source web page;With
Trigger triggers and receives the message when there is the message from source web page,
The customization message receiver includes:
Whether the particular attribute-value of timer, regular check target webpage changes and is not sky.
C13, the message reception facility according to any one of C9-C12, further includes:
Message handling device, handle the standard message receiver or the customization message receiver received disappear Breath.
C14, the message reception facility as described in any one of C9-C13, wherein
The particular attribute-value of the target webpage is the name attribute value of window object.
D15, a kind of message receival method, for making the target webpage in browser receive the message from source web page, institute State message receival method comprising steps of
Whether the particular attribute-value of regular check target webpage changes, if the particular attribute-value changes, Handle the particular attribute-value then to obtain the message from source web page.
D16, the message receival method according to D15, further include following steps:
Determine whether browser supports message transfer mechanism between domain,
Between determining that the browser supports domain when message transfer mechanism, come with message receiving mode between domain to receive From the message of source web page, and
Between determining that the browser does not support domain when message transfer mechanism, the particular community of regular check target webpage Whether value changes, if the particular attribute-value changes, handles the particular attribute-value to obtain and come from source web page Message.
D17, the message receival method according to D15 or D16, wherein the source web page and the target webpage belong to not Same URL/domain.
D18, the message receival method according to D15-D17, wherein
The particular attribute-value of the target webpage is the name attribute value of window object.
E19, a kind of communication system of browser, the communication being used between source web page and target webpage, the source web page And target webpage respectively include:
The message sending device according to any one of A1, A3 and A4;And
The message reception facility according to any one of C9 and C11-C14.
F20, a kind of communication system of browser, the communication being used between source web page and target webpage, the source web page And target webpage respectively include:
The message sending device according to any one of A2, A3 and A4;And
The message reception facility according to any one of C10 and C11-C14.
G21, a kind of communication means of browser, the communication being used between source web page and target webpage, the communication means Include:
The message method according to B5;And
The message receival method according to D15.
H22, a kind of communication means of browser, the communication being used between source web page and target webpage, the communication means Include:
The message method according to any one of B6-B8;And
The message receival method according to any one of D16-D18.

Claims (13)

1. a kind of message sending device, suitable for the message from source web page is sent to target webpage in a browser, the message Sending device includes:
Message sender is customized, is sent by modifying the message of particular attribute-value source web page to be sent of target webpage To target webpage;Wherein, the particular attribute-value is the name attribute value of window object;
Standard message transmitter is sent to target network by the message of the source web page to be sent of message mode between domain Page;And
First judging device, determines whether the browser supports message transfer mechanism between the domain of HTML5, described clear when determining When device of looking at supports message transfer mechanism between the domain of HTML5, the messaging of source web page to be sent to the standard message Transmitter, it is to be sent between the first judging device determines that the browser does not support the domain of HTML5 when message transfer mechanism The messaging of source web page is to the customization message sender.
2. message sending device as described in claim 1, wherein source web page and target webpage belong to different URL/domains.
3. a kind of message method, for the message from source web page to be sent to target webpage in a browser, including step It is rapid:
Determine whether browser supports message transfer mechanism between the domain of HTML5,
When message transfer mechanism between the domain for determining the browser support HTML5, the message of source web page to be sent is logical The message for crossing message mode source web page to be sent between domain is sent to target webpage, and
When message transfer mechanism between the domain that the judgement browser does not support HTML5, pass through the specific of modification target webpage Attribute value and the message of source web page to be sent is sent to target webpage;
Wherein, the particular attribute-value is the name attribute value of window object.
4. message method according to claim 3, wherein source web page and target webpage belong to different URL/domains.
5. a kind of message reception facility, suitable for receiving the message from source web page from target webpage in a browser, which is connect Receiving unit includes:
Message receiver is customized, whether the particular attribute-value of regular check target webpage changes, if the specified genus Property value changes, then handles the particular attribute-value to obtain the message from source web page;Wherein, the particular attribute-value is The name attribute value of window object;
Standard message receiver receives the message from source web page with message receiving mode between domain;With
Second judging device, determines whether the browser supports message transfer mechanism between the domain of HTML5, described clear when determining Between the domain of device of looking at support HTML5 when message transfer mechanism, disappearing from the source page is received by the standard message receiver Breath, between the second judging device determines that the browser does not support the domain of HTML5 when message transfer mechanism, by the customization message Receiver receives the message from the source page.
6. message reception facility as claimed in claim 5, wherein the source web page and the target webpage belong to different URL Domain.
7. message reception facility according to claim 5 or 6, wherein
The standard message receiver includes:
Monitor is monitored whether from the message of source web page;With
Trigger triggers and receives the message when there is the message from source web page,
The customization message receiver includes:
Whether the particular attribute-value of timer, regular check target webpage changes and is not sky.
8. message reception facility according to claim 5 or 6, further includes:
Message handling device handles the received message of the standard message receiver or customization message receiver institute.
9. a kind of message receival method, for making the target webpage in browser receive the message from source web page, the message Method of reseptance comprising steps of
Determine whether browser supports message transfer mechanism between the domain of HTML5,
Between determining that the browser supports the domain of HTML5 when message transfer mechanism, connect with message receiving mode between domain The message from source web page is received, and
Between determining that the browser does not support the domain of HTML5 when message transfer mechanism, regular check target webpage it is specific Whether attribute value changes, if the particular attribute-value changes, handles the particular attribute-value to obtain the source of coming from The message of webpage;
Wherein, the particular attribute-value is the name attribute value of window object.
10. message receival method according to claim 9, wherein the source web page and the target webpage belong to it is different URL/domain.
11. a kind of communication system of browser, the communication being used between source web page and target webpage, the source web page and target Webpage respectively include:
According to claim 1 with message sending device described in any one of 2;And
According to message reception facility described in any one of claim 5-8.
12. a kind of communication means of browser, the communication being used between source web page and target webpage, the communication means include:
Message method according to claim 3;And
Message receival method according to claim 9.
13. a kind of communication means of browser, the communication being used between source web page and target webpage, the communication means include:
Message method according to claim 4;And
Message receival method according to claim 10.
CN201510624780.1A 2012-10-19 2012-10-19 Message sending device and receiving device and method and system in browser Expired - Fee Related CN105306341B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510624780.1A CN105306341B (en) 2012-10-19 2012-10-19 Message sending device and receiving device and method and system in browser

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510624780.1A CN105306341B (en) 2012-10-19 2012-10-19 Message sending device and receiving device and method and system in browser
CN201210401336.XA CN102882982B (en) 2012-10-19 2012-10-19 Message transmitting apparatus in browser and receiving equipment and method and system

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201210401336.XA Division CN102882982B (en) 2012-10-19 2012-10-19 Message transmitting apparatus in browser and receiving equipment and method and system

Publications (2)

Publication Number Publication Date
CN105306341A CN105306341A (en) 2016-02-03
CN105306341B true CN105306341B (en) 2019-05-28

Family

ID=47484124

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201210401336.XA Active CN102882982B (en) 2012-10-19 2012-10-19 Message transmitting apparatus in browser and receiving equipment and method and system
CN201510624780.1A Expired - Fee Related CN105306341B (en) 2012-10-19 2012-10-19 Message sending device and receiving device and method and system in browser

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN201210401336.XA Active CN102882982B (en) 2012-10-19 2012-10-19 Message transmitting apparatus in browser and receiving equipment and method and system

Country Status (2)

Country Link
CN (2) CN102882982B (en)
WO (1) WO2014059930A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102882982B (en) * 2012-10-19 2015-10-07 北京奇虎科技有限公司 Message transmitting apparatus in browser and receiving equipment and method and system
CN105373548B (en) * 2014-08-25 2020-10-13 腾讯科技(深圳)有限公司 Mobile device and method for customizing event by browser thereof
CN104317819A (en) * 2014-09-28 2015-01-28 北京京东尚科信息技术有限公司 Method and system for webpage cross-domain communication based on browsers
CN113329028B (en) * 2021-06-17 2022-08-30 中国农业银行股份有限公司 Cross-domain access method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102043832A (en) * 2010-11-23 2011-05-04 苏州阔地网络科技有限公司 Method for realizing cross-domain request callback on webpage
CN102393857A (en) * 2011-11-01 2012-03-28 中兴通讯股份有限公司 Method and system for local call based on web page
CN102662600A (en) * 2012-04-28 2012-09-12 北京亿中邮信息技术有限公司 Method for mutually dragging files at different domain names

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101106572A (en) * 2007-08-23 2008-01-16 中兴通讯股份有限公司 Method for cross-domain communication between resource control function units
CN102917058B (en) * 2012-10-19 2016-06-29 北京奇虎科技有限公司 A kind of communication means and system
CN102882982B (en) * 2012-10-19 2015-10-07 北京奇虎科技有限公司 Message transmitting apparatus in browser and receiving equipment and method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102043832A (en) * 2010-11-23 2011-05-04 苏州阔地网络科技有限公司 Method for realizing cross-domain request callback on webpage
CN102314469A (en) * 2010-11-23 2012-01-11 苏州阔地网络科技有限公司 Method for implementing cross-domain request callback
CN102393857A (en) * 2011-11-01 2012-03-28 中兴通讯股份有限公司 Method and system for local call based on web page
CN102662600A (en) * 2012-04-28 2012-09-12 北京亿中邮信息技术有限公司 Method for mutually dragging files at different domain names

Also Published As

Publication number Publication date
CN105306341A (en) 2016-02-03
CN102882982B (en) 2015-10-07
WO2014059930A1 (en) 2014-04-24
CN102882982A (en) 2013-01-16

Similar Documents

Publication Publication Date Title
CN105335404B (en) Page info loading method and device
CN103685258B (en) A kind of method and apparatus of quick scans web sites loophole
CN104572968B (en) A kind of method for updating pages and device
CN103020826B (en) Payment processing method and server
US9785710B2 (en) Automatic crawling of encoded dynamic URLs
CN105306341B (en) Message sending device and receiving device and method and system in browser
JP2012533806A (en) XSS detection method and apparatus
CN102833258A (en) Website access method and system
CN105631341B (en) Blind detection method and device for vulnerability
CN103117893A (en) Monitor method and device of network accessing behaviour and client device
US20170371888A1 (en) Method for advertisement interception in dual-kernel browser and browser apparatus
CN104021154B (en) A kind of method and apparatus scanned in a browser
US20140317489A1 (en) Device-independent validation of website elements
CN105516333B (en) A kind of web-based exchange method and system
CN102938766A (en) Vicious website prompt method and device
CN102981846A (en) Method for treating password input box element and browser for treating the password input box element
WO2012155095A1 (en) System and method for electronic lead verification
CN103077349B (en) A kind of method of browser side prompting access secure information and device
WO2008075883A1 (en) Advertisement method by the proxy server and advertisement system operating the advertisement method
CN103544271B (en) Load Image in a kind of browser the method and apparatus for processing window
CN103618742B (en) Webmaster's method for verifying authority
CN102946391A (en) Method for prompting malicious website in browser and browser
CN114491560A (en) Vulnerability detection method and device, storage medium and electronic equipment
CN105930385A (en) Data crawling method and system
CN102917058B (en) A kind of communication means and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220714

Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Patentee before: Qizhi software (Beijing) Co.,Ltd.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190528