CN104778405B - Ad blocking method and device - Google Patents

Ad blocking method and device Download PDF

Info

Publication number
CN104778405B
CN104778405B CN201510106749.9A CN201510106749A CN104778405B CN 104778405 B CN104778405 B CN 104778405B CN 201510106749 A CN201510106749 A CN 201510106749A CN 104778405 B CN104778405 B CN 104778405B
Authority
CN
China
Prior art keywords
node
webpage
advertising
predetermined condition
module
Prior art date
Application number
CN201510106749.9A
Other languages
Chinese (zh)
Other versions
CN104778405A (en
Inventor
范金松
张少伟
孙大禹
Original Assignee
小米科技有限责任公司
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 小米科技有限责任公司 filed Critical 小米科技有限责任公司
Priority to CN201510106749.9A priority Critical patent/CN104778405B/en
Publication of CN104778405A publication Critical patent/CN104778405A/en
Application granted granted Critical
Publication of CN104778405B publication Critical patent/CN104778405B/en

Links

Abstract

The disclosure discloses a kind of Ad blocking method and device, belongs to web page analysis and identification technology field.The described method includes:After obtaining webpage loading, the node that is inserted into the DOM Document Object Model of the webpage;Detect whether the node is advertising node;If testing result is that the node is advertising node, the node is not shown.The node that is inserted into the DOM Document Object Model of webpage after the disclosure is loaded by obtaining webpage, if it is detected that the node is advertising node, then the node is not shown, it is detected by the node for completing to be inserted into afterwards to webpage loading, if advertising node, then the node is intercepted, can effectively intercept the advertisement generated at random by Javascript, improves the accuracy of Ad blocking.

Description

Ad blocking method and device

Technical field

This disclosure relates to web page analysis and identification technology field, more particularly to a kind of Ad blocking method and device.

Background technology

With flourishing for e-commerce, more and more webpages are inserted into miscellaneous advertisement.In order to avoid this A little advertisements browse webpage to user is made troubles, it is necessary to which the advertisement in webpage is intercepted.

In the related art, various advertising filtering functions be generally all expansion to AdBlock open source projects functions and Customization.For example an advertisement filter list is set, the URL link of each advertising pictures can be included in the advertisement filter list Or the cascading style sheets CSS selector of advertising node, please to the URL resources in advertisement filter list in web page loading process Ask and intercepted, and attribute setting is carried out to all advertising nodes by CSS selector, make it invisible on webpage.

The content of the invention

Present disclose provides a kind of Ad blocking method and device.The technical solution is as follows:

First aspect, there is provided a kind of Ad blocking method, the described method includes:

After obtaining webpage loading, the node that is inserted into the DOM Document Object Model of the webpage;

Detect whether the node is advertising node;

If testing result is that the node is advertising node, the node is not shown.

Optionally, after the acquisition webpage loading, the node that is inserted into the DOM Document Object Model of the webpage, bag Include:

Event sniffer is added in the DOM Document Object Model;

Obtain the node corresponding to the node insertion event that the event sniffer listens to.

Optionally, it is described to add event sniffer in the DOM Document Object Model, including:

The event sniffer is added in the body nodes of the DOM Document Object Model.

Optionally, whether the detection node is advertising node, including:

Whether the cascading style sheets CSS attributes for detecting the node meet the first predetermined condition;

If the CSS attributes of the node meet first predetermined condition, detect the node contents attribute whether Meet the second predetermined condition, the contents attribute is included in class, identity, son node number and Text node contents at least It is a kind of;

If the contents attribute of the node meets second predetermined condition, it is determined that the node is advertising node.

Optionally, first predetermined condition includes:

Display property values in the CSS attributes are block, and the position property values in the CSS attributes are Fixed or relative.

Optionally, second predetermined condition includes at least one of following condition:

The first designated character is included in the class of the node;

The second designated character is included in the identity of the node;

The son node number of the node is less than predetermined son node number;

And the length of the Text node contents of the node is less than predetermined content length, and the Text sections of the node The 3rd designated character is included in point content.

Optionally, it is described that the node is not shown, including:

The display properties of the node is arranged to show.

Optionally, the method further includes:

When including picture in the node, the resource initiated according to the uniform resource position mark URL of the picture is shielded Request.

Second aspect, there is provided a kind of Ad blocking device, described device include:

Node acquisition module, after obtaining webpage loading, is inserted into the DOM Document Object Model of the webpage Node;

Detection module, for detecting whether the node is advertising node;

Blocking module, if it is advertising node that the testing result for the detection module, which is the node, to the section Point is not shown.

Optionally, the node acquisition module, including:

Submodule is added, for adding event sniffer in the DOM Document Object Model;

Node acquisition submodule, the section corresponding to node insertion event listened to for obtaining the event sniffer Point.

Optionally, the addition submodule, for adding the event in the body nodes of the DOM Document Object Model Monitor.

Optionally, the detection module, including:

Whether the first detection sub-module, the cascading style sheets CSS attributes for detecting the node meet the first predetermined bar Part;

Second detection sub-module, if the CSS attributes for the node meet first predetermined condition, described in detection Whether the contents attribute of node meets the second predetermined condition, the contents attribute include class, identity, son node number and At least one of Text node contents;

Determination sub-module, if the contents attribute for the node meets second predetermined condition, it is determined that the section Point is advertising node.

Optionally, first predetermined condition includes:

Display property values in the CSS attributes are block, and the position property values in the CSS attributes are Fixed or relative.

Optionally, second predetermined condition includes at least one of following condition:

The first designated character is included in the class of the node;

The second designated character is included in the identity of the node;

The son node number of the node is less than predetermined son node number;

And the length of the Text node contents of the node is less than predetermined content length, and the Text sections of the node The 3rd designated character is included in point content.

Optionally, the blocking module, for the display properties of the node to be arranged to show.

Optionally, described device further includes:

Shroud module is asked, for when including picture in the node, shielding and determining according to the unified resource of the picture The resource request that position symbol URL is initiated.

The third aspect, there is provided a kind of Ad blocking device, described device include:

Processor;

For storing the memory of processor-executable instruction;

Wherein, the processor is configured as:

After obtaining webpage loading, the node that is inserted into the DOM Document Object Model of the webpage;

Detect whether the node is advertising node;

If testing result is that the node is advertising node, the node is not shown.

The technical scheme provided by this disclosed embodiment can include the following benefits:

The node being inserted into after by obtaining webpage loading in the DOM Document Object Model of webpage, if it is detected that the node It is advertising node, then the node is not shown, is detected by the node for completing to be inserted into afterwards to webpage loading, if extensively Node is accused, then the node is intercepted, can effectively intercept the advertisement generated at random by Javascript, improves advertisement The accuracy of interception.

It should be appreciated that the general description and following detailed description of the above are only exemplary, this can not be limited It is open.

Brief description of the drawings

Attached drawing herein is merged in specification and forms the part of this specification, shows the implementation for meeting the present invention Example, and in specification together for explaining the principle of the present invention.

Fig. 1 is a kind of flow chart of Ad blocking method according to an exemplary embodiment;

Fig. 2 is a kind of flow chart of the Ad blocking method shown according to another exemplary embodiment;

Fig. 3 is a kind of flow chart of Ad blocking method according to further example embodiment;

Fig. 4 is the block diagram of the Ad blocking device according to an exemplary embodiment;

Fig. 5 is a kind of block diagram of the Ad blocking device shown according to another exemplary embodiment;

Fig. 6 is a kind of block diagram of Ad blocking device according to an exemplary embodiment.

Embodiment

Here explanation will be performed to exemplary embodiment in detail, its example is illustrated in the accompanying drawings.Following description is related to During attached drawing, unless otherwise indicated, the same numbers in different attached drawings represent the same or similar key element.Following exemplary embodiment Described in embodiment do not represent and the consistent all embodiments of the present invention.On the contrary, they be only with it is such as appended The example of the consistent apparatus and method of some aspects being described in detail in claims, of the invention.

Fig. 1 is a kind of flow chart of Ad blocking method according to an exemplary embodiment.The Ad blocking method It can be used for being provided with the electronic equipment of browser.As shown in Figure 1, the Ad blocking method may comprise steps of.

In a step 102, after obtaining webpage loading, the node that is inserted into the DOM Document Object Model of the webpage.

At step 104, detect whether the node is advertising node.

In step 106, if it is advertising node that testing result, which is the node, which is not shown.

Optionally, after acquisition webpage loading, the node that is inserted into the DOM Document Object Model of the webpage, including:

Event sniffer is added in the document object model;

Obtain the node corresponding to the node insertion event that the event sniffer listens to.

Optionally, event sniffer should be added in the document object model, including:

The event sniffer is added in the body nodes of the document object model.

Optionally, whether the detection node is advertising node, including:

Whether the cascading style sheets CSS attributes for detecting the node meet the first predetermined condition;

If the CSS attributes of the node meet first predetermined condition, whether the contents attribute for detecting the node meets Two predetermined conditions, the contents attribute include at least one of class, identity, son node number and Text node contents;

If the contents attribute of the node meets second predetermined condition, it is determined that the node is advertising node.

Optionally, which includes:

Display property values in the CSS attributes are block, and the position property values in the CSS attributes are Fixed or relative.

Optionally, which includes at least one of following condition:

The first designated character is included in the class of the node;

The second designated character is included in the identity of the node;

The son node number of the node is less than predetermined son node number;

And the length of the Text node contents of the node is less than predetermined content length, and in the Text nodes of the node The 3rd designated character is included in appearance.

Optionally, this not shows the node, including:

The display properties of the node is arranged to show.

Optionally, this method further includes:When including picture in the node, shield and positioned according to the unified resource of the picture Accord with the resource request that URL is initiated.

In conclusion the Ad blocking method provided in the embodiment of the present disclosure, in net after being loaded by obtaining webpage The node being inserted into the DOM Document Object Model of page, if it is detected that the node is advertising node, then not shows the node, passes through The node for completing to be inserted into afterwards to webpage loading is detected, if advertising node, then the node is intercepted, can be effective The advertisement that is generated at random by Javascript of interception, improve the accuracy of Ad blocking.

Fig. 2 is a kind of flow chart of the Ad blocking method shown according to another exemplary embodiment.The Ad blocking side Method can be used for being provided with the electronic equipment of browser.As shown in Fig. 2, the Ad blocking method may comprise steps of.

In step 202, event sniffer is added in the body nodes of the DOM Document Object Model of webpage.

When the advertisement in webpage is generated using JavaScript technologies, since the execution time of Javascript codes has The methods of having randomness, while can setting timer or event, generates when occurring at a random time point or some event Some advertisements.The characteristics of this series advertisements, is, after webpage loads, ad content is generated by Javascript, then will Node containing these ad contents is added in former webpage.

, can be in DOM (Document Object Model, the document of webpage in the scheme shown in the embodiment of the present disclosure Object model) in addition event sniffer, due to webpage all the elements node all can on body nodes, Ke Yi The event sniffer is added on the body nodes of the DOM Document Object Model of webpage.

In step 204, after webpage loading, obtain corresponding to the node insertion event that event sniffer listens to Node.

The event sniffer can be inserted into just for the node on the body nodes of the DOM Document Object Model of webpage (insert) event is monitored, and after webpage loads completely, browser can obtain the node that event sniffer listens to Node corresponding to insertion event.

In step 206, detect whether the node is advertising node.

When browser gets the node corresponding to node insertion event, whether the node for first determining whether the insertion is advertisement Node, if so, step 208 is then performed, if it is not, then browser handles the node of insertion according to normal procedure.

In a step 208, if it is advertising node that testing result, which is the node, which is not shown.

If the node of the insertion is advertising node, browser only needs to generate corresponding filtering rule, you can carries out Ad content in node is intercepted.

In conclusion the Ad blocking method provided in the embodiment of the present disclosure, in net after being loaded by obtaining webpage The node being inserted into the DOM Document Object Model of page, if it is detected that the node is advertising node, then not shows the node, passes through The node for completing to be inserted into afterwards to webpage loading is detected, if advertising node, then the node is intercepted, can be effective The advertisement that is generated at random by Javascript of interception, improve the accuracy of Ad blocking.

Fig. 3 is a kind of flow chart of Ad blocking method according to further example embodiment.The Ad blocking side Method can be used for being provided with the electronic equipment of browser.As shown in figure 3, the Ad blocking method may comprise steps of.

In step 302, event sniffer is added in the body nodes of the DOM Document Object Model of webpage.

When the advertisement in webpage is generated using JavaScript technologies, since the execution time of Javascript codes has The methods of having randomness, while can setting timer or event, generates when occurring at a random time point or some event Some advertisements.The characteristics of this series advertisements, is, after webpage loads, ad content is generated by Javascript, then will Node containing these ad contents is added in former webpage.

In the scheme shown in the embodiment of the present disclosure, event sniffer can be added in the DOM of webpage, due to webpage All the elements node all can be on body nodes, therefore, and can be added on the body nodes of the DOM Document Object Model of webpage should Event sniffer.

In step 304, after webpage loading, obtain corresponding to the node insertion event that event sniffer listens to Node.

The event sniffer can be inserted into just for the node on the body nodes of the DOM Document Object Model of webpage (insert) event is monitored, and after webpage loads completely, browser can obtain the node that event sniffer listens to Node corresponding to insertion event.

Within step 306, whether the cascading style sheets CSS attributes for detecting the node meet the first predetermined condition.

Wherein, which includes:In CSS (the Cascading Style Sheets cascading style sheets) attribute Display property values be block, and the position property values in the CSS attributes are fixed or relative.

When whether the node of detection insertion is advertising node, whether the CSS attributes for detecting the node first meet advertisement Display property values in the CSS attributes of the feature of node, the i.e. node are block, and the position in the CSS attributes Property value is fixed or relative, if both has any one not meet, it may be considered that the node is not advertising node, Subsequent step need not be performed again.If both of which meets, which is probably advertising node, it is also necessary to is carried out again follow-up Detecting step is to be confirmed.

In step 308, if the CSS attributes of the node meet first predetermined condition, the content category of the node is detected Whether property meets the second predetermined condition.

Wherein, which includes at least one of class, identity, son node number and Text node contents.

Wherein, which includes at least one of following condition:

1) the first designated character is included in the class of the node;

It may include if including advertisement in the node, in the class (class) of the node and be specified with advertisement relevant first Character, such as ad, ads etc..

2) the second designated character is included in the identity of the node;

With the 1) put it is similar, can in the ID (Identify, identity tag) of the node if including advertisement in the node It can include and relevant second designated character of advertisement, such as ad, ads etc..

3) son node number of the node is less than predetermined son node number;

Under normal conditions, the number of child nodes of advertising node will not be too many, such as, the number of child nodes of advertising node is general Not over 30, therefore, it is 30 that can set the predetermined son node number.

4) length of the Text node contents of the node is less than predetermined content length, and in the Text node contents of the node Include the 3rd designated character.

Under normal conditions, ad content all compares refining, generally not over 50 characters, therefore can be predetermined interior by this Hold length and be arranged to 50 characters, can be with when browser detects that the length of the Text node contents of the node is less than 50 character Further detect in the Text node contents whether include with relevant 3rd designated character of advertisement, such as, ad, adv, ads, beat Folding, promotion etc..If browser detects that the length of the Text node contents of the node is not less than 50 characters, not to Text nodes Content carries out the detection of the 3rd designated character.

In the step 310, if the contents attribute of the node meets second predetermined condition, it is determined that the node is advertisement section Point.

If it is detected that any one in four kind of second predetermined condition in above-mentioned steps 308 or more than one establishments, It is advertising node that can think the node.

In step 312, the display properties of the node is arranged to show.

If it is determined that the node of the insertion is advertising node, then browser can be set in the CSS attributes of the node Display property values are none.

In a step 314, when including picture in the node, shield and sent out according to the uniform resource position mark URL of the picture The resource request risen.

If can also be according to the URL (Uniform of picture therein comprising resource, browsers such as pictures in the advertising node Resource Locator, uniform resource locator) the corresponding filtering rule of generation, then these filtering rules generated are transmitted to The advertisement filter module of browser, advertisement filter module can shield the resource request initiated according to the URL of these advertisements.

In conclusion the Ad blocking method provided in the embodiment of the present disclosure, in net after being loaded by obtaining webpage The node being inserted into the DOM Document Object Model of page, if it is detected that the node is advertising node, then not shows the node, passes through The node for completing to be inserted into afterwards to webpage loading is detected, if advertising node, then the node is intercepted, can be effective The advertisement that is generated at random by Javascript of interception, improve the accuracy of Ad blocking.

Following is embodiment of the present disclosure, can be used for performing embodiments of the present disclosure.It is real for disclosure device The details not disclosed in example is applied, refer to embodiments of the present disclosure.

Fig. 4 is a kind of block diagram of Ad blocking device according to an exemplary embodiment, which can For being provided with the electronic equipment of browser, the Ad blocking method as shown in Fig. 1 to 3 is any is performed.As shown in figure 4, The Ad blocking device includes but not limited to:Node acquisition module 401, detection module 402 and blocking module 403;

The node acquisition module 401 is arranged to be used for after obtaining webpage loading, in the document pair of the webpage As the node being inserted into model;

The detection module 402 is arranged to be used for detecting whether the node is advertising node;

If it is wide that the testing result that the blocking module 403 is arranged to be used for the detection module 402, which is the node, Node is accused, then the node is not shown.

In conclusion the Ad blocking device provided in the embodiment of the present disclosure, in net after being loaded by obtaining webpage The node being inserted into the DOM Document Object Model of page, if it is detected that the node is advertising node, then not shows the node, passes through The node for completing to be inserted into afterwards to webpage loading is detected, if advertising node, then the node is intercepted, can be effective The advertisement that is generated at random by Javascript of interception, improve the accuracy of Ad blocking.

Fig. 5 is a kind of block diagram of the Ad blocking device shown according to another exemplary embodiment, the Ad blocking device It can be used for being provided with the electronic equipment of browser, perform the Ad blocking method as shown in Fig. 1 to 3 is any.Such as Fig. 5 institutes Show, which includes but not limited to:Node acquisition module 401, detection module 402 and blocking module 403;

The node acquisition module 401 is arranged to be used for after obtaining webpage loading, in the document pair of the webpage As the node being inserted into model;

The detection module 402 is arranged to be used for detecting whether the node is advertising node;

If it is wide that the testing result that the blocking module 403 is arranged to be used for the detection module 402, which is the node, Node is accused, then the node is not shown.

Optionally, the node acquisition module 401, including:Add submodule 401a and node acquisition submodule 401b;

The addition submodule 401a, which is arranged in use in the DOM Document Object Model, adds event sniffer;

The node acquisition submodule 401b is arranged to be used for obtaining the node insertion that the event sniffer listens to Node corresponding to event.

Optionally, the addition submodule 401a, which is arranged in use in the body nodes of the DOM Document Object Model, adds Add the event sniffer.

Optionally, the detection module 402, including:First detection sub-module 402a, the second detection sub-module 402b and Determination sub-module 402c;

The first detection sub-module 402a be arranged to be used for detecting the node cascading style sheets CSS attributes whether Meet the first predetermined condition;

If the CSS attributes that the second detection sub-module 402b is arranged to be used for the node meet that described first is predetermined Whether condition, the then contents attribute for detecting the node meet the second predetermined condition, and the contents attribute includes class, identity mark At least one of knowledge, son node number and Text node contents;

If the contents attribute that the determination sub-module 402c is arranged to be used for the node meets the described second predetermined bar Part, it is determined that the node is advertising node.

Optionally, first predetermined condition includes:

Display property values in the CSS attributes are block, and the position property values in the CSS attributes are Fixed or relative.

Optionally, second predetermined condition includes at least one of following condition:

The first designated character is included in the class of the node;

The second designated character is included in the identity of the node;

The son node number of the node is less than predetermined son node number;

And the length of the Text node contents of the node is less than predetermined content length, and the Text sections of the node The 3rd designated character is included in point content.

Optionally, the blocking module 403 is arranged to be used for being arranged to show by the display properties of the node.

Optionally, described device further includes:Ask shroud module 404;

The request shroud module 404 is arranged to be used for, when including picture in the node, shielding according to the figure The resource request that the uniform resource position mark URL of piece is initiated.

In conclusion the Ad blocking device provided in the embodiment of the present disclosure, in net after being loaded by obtaining webpage The node being inserted into the DOM Document Object Model of page, if it is detected that the node is advertising node, then not shows the node, passes through The node for completing to be inserted into afterwards to webpage loading is detected, if advertising node, then the node is intercepted, can be effective The advertisement that is generated at random by Javascript of interception, improve the accuracy of Ad blocking.

Fig. 6 is a kind of block diagram of Ad blocking device 600 according to an exemplary embodiment.For example, device 600 can To be mobile phone, computer, digital broadcast terminal, messaging devices, routing device, game console, tablet device, is cured Treat equipment, body-building equipment, personal digital assistant etc..

With reference to Fig. 6, device 600 can include following one or more assemblies:Processing component 602, memory 604, power supply Component 606, multimedia component 608, audio component 610, the interface 612 of input/output (I/O), sensor component 614, and Communication component 616.

The integrated operation of the usual control device 600 of processing component 602, such as with display, call, data communication, phase The operation that machine operates and record operation is associated.Processing component 602 can refer to including one or more processors 618 to perform Order, to complete all or part of step of above-mentioned method.In addition, processing component 602 can include one or more modules, just Interaction between processing component 602 and other assemblies.For example, processing component 602 can include multi-media module, it is more to facilitate Interaction between media component 608 and processing component 602.

Memory 604 is configured as storing various types of data to support the operation in device 600.These data are shown Example includes the instruction of any application program or method for being operated on device 600, and contact data, telephone book data, disappears Breath, picture, video etc..Memory 604 can be by any kind of volatibility or non-volatile memory device or their group Close and realize, as static RAM (SRAM), electrically erasable programmable read-only memory (EEPROM) are erasable to compile Journey read-only storage (EPROM), programmable read only memory (PROM), read-only storage (ROM), magnetic memory, flash Device, disk or CD.One or more modules are also stored with memory 604, which is configured to by this One or more processors 620 perform, to complete all or part of step of any shown methods of above-mentioned Fig. 1 to 3.

Power supply module 606 provides electric power for the various assemblies of device 600.Power supply module 606 can include power management system System, one or more power supplys, and other components associated with generating, managing and distributing electric power for device 600.

Multimedia component 608 is included in the screen of one output interface of offer between described device 600 and user.One In a little embodiments, screen can include liquid crystal display (LCD) and touch panel (TP).If screen includes touch panel, screen Curtain may be implemented as touch-screen, to receive input signal from the user.Touch panel includes one or more touch sensings Device is to sense the gesture on touch, slip and touch panel.The touch sensor can not only sense touch or sliding action Border, but also detect and the duration and pressure associated with the touch or slide operation.In certain embodiments, more matchmakers Body component 608 includes a front camera and/or rear camera.When device 600 is in operator scheme, such as screening-mode or During video mode, front camera and/or rear camera can receive exterior multi-medium data.Each front camera and Rear camera can be a fixed optical lens system or have focusing and optical zoom capabilities.

Audio component 610 is configured as output and/or input audio signal.For example, audio component 610 includes a Mike Wind (MIC), when device 600 is in operator scheme, during such as call model, logging mode and speech recognition mode, microphone by with It is set to reception external audio signal.The received audio signal can be further stored in memory 604 or via communication set Part 616 is sent.In certain embodiments, audio component 610 further includes a loudspeaker, for exports audio signal.

I/O interfaces 612 provide interface between processing component 602 and peripheral interface module, and above-mentioned peripheral interface module can To be keyboard, click wheel, button etc..These buttons may include but be not limited to:Home button, volume button, start button and lock Determine button.

Sensor component 614 includes one or more sensors, and the state for providing various aspects for device 600 is commented Estimate.For example, sensor component 614 can detect opening/closed mode of device 600, and the relative positioning of component, for example, it is described Component is the display and keypad of device 600, and sensor component 614 can be with 600 1 components of detection device 600 or device Position change, the existence or non-existence that user contacts with device 600,600 orientation of device or acceleration/deceleration and device 600 Temperature change.Sensor component 614 can include proximity sensor, be configured to detect without any physical contact Presence of nearby objects.Sensor component 614 can also include optical sensor, such as CMOS or ccd image sensor, for into As being used in application.In certain embodiments, which can also include acceleration transducer, gyro sensors Device, Magnetic Sensor, pressure sensor or temperature sensor.

Communication component 616 is configured to facilitate the communication of wired or wireless way between device 600 and other equipment.Device 600 can access the wireless network based on communication standard, such as WiFi, 2G or 3G, or combinations thereof.In an exemplary implementation In example, communication component 616 receives broadcast singal or broadcast related information from external broadcasting management system via broadcast channel. In one exemplary embodiment, the communication component 616 further includes near-field communication (NFC) module, to promote junction service.Example Such as, in NFC module radio frequency identification (RFID) technology can be based on, Infrared Data Association (IrDA) technology, ultra wide band (UWB) technology, Bluetooth (BT) technology and other technologies are realized.

In the exemplary embodiment, device 600 can be believed by one or more application application-specific integrated circuit (ASIC), numeral Number processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are realized, for performing the above method.

In the exemplary embodiment, a kind of non-transitorycomputer readable storage medium including instructing, example are additionally provided Such as include the memory 604 of instruction, above-metioned instruction can be performed to complete the above method by the processor 618 of device 600.For example, The non-transitorycomputer readable storage medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk With optical data storage devices etc..

On the device in above-described embodiment, wherein modules perform the concrete mode of operation in related this method Embodiment in perform detailed description, explanation will be not set forth in detail herein.

It should be appreciated that the invention is not limited in the precision architecture for being described above and being shown in the drawings, and And various modifications and change can be being performed without departing from the scope.The scope of the present invention is only limited by appended claim.

Claims (13)

  1. A kind of 1. Ad blocking method, it is characterised in that the described method includes:
    Event sniffer is added in the body nodes of the DOM Document Object Model of webpage, the event sniffer is directed to the webpage DOM Document Object Model body nodes on node insertion event monitored;
    After obtaining webpage loading, what what the event sniffer listened to be inserted into the DOM Document Object Model of the webpage Node;
    Detect whether the node is advertising node;
    If testing result is that the node is advertising node, the node is not shown.
  2. 2. according to the method described in claim 1, it is characterized in that, whether the detection node is advertising node, including:
    Whether the cascading style sheets CSS attributes for detecting the node meet the first predetermined condition;
    If the CSS attributes of the node meet first predetermined condition, whether the contents attribute for detecting the node meets Second predetermined condition, the contents attribute include at least one in class, identity, son node number and Text node contents Kind;
    If the contents attribute of the node meets second predetermined condition, it is determined that the node is advertising node.
  3. 3. according to the method described in claim 2, it is characterized in that, first predetermined condition includes:
    Display property values in the CSS attributes are block, and the position property values in the CSS attributes are Fixed or relative.
  4. 4. according to the method described in claim 3, it is characterized in that, second predetermined condition is included in following condition at least It is a kind of:
    The first designated character is included in the class of the node;
    The second designated character is included in the identity of the node;
    The son node number of the node is less than predetermined son node number;
    And the length of the Text node contents of the node is less than predetermined content length, and in the Text nodes of the node The 3rd designated character is included in appearance.
  5. 5. according to the method described in claim 1, it is characterized in that, it is described to the node not show, including:
    The display properties of the node is arranged to show.
  6. 6. according to the method described in claim 5, it is characterized in that, the method further includes:
    When including picture in the node, the resource request initiated according to the uniform resource position mark URL of the picture is shielded.
  7. 7. a kind of Ad blocking device, it is characterised in that described device includes:
    Submodule is added, for adding event sniffer, the event prison in the body nodes of the DOM Document Object Model in webpage Device is listened to be monitored for the node insertion event on the body nodes of the DOM Document Object Model of the webpage;
    Node acquisition module, after obtaining webpage loading, the text in the webpage that the event sniffer listens to The node being inserted into shelves object model;
    Detection module, for detecting whether the node is advertising node;
    Blocking module, if it is advertising node that the testing result for the detection module, which is the node, to the node not Give display.
  8. 8. device according to claim 7, it is characterised in that the detection module, including:
    Whether the first detection sub-module, the cascading style sheets CSS attributes for detecting the node meet the first predetermined condition;
    Second detection sub-module, if the CSS attributes for the node meet first predetermined condition, detects the node Contents attribute whether meet the second predetermined condition, the contents attribute includes class, identity, son node number and Text sections At least one of point content;
    Determination sub-module, if the contents attribute for the node meets second predetermined condition, it is determined that the node is Advertising node.
  9. 9. device according to claim 8, it is characterised in that first predetermined condition includes:
    Display property values in the CSS attributes are block, and the position property values in the CSS attributes are Fixed or relative.
  10. 10. device according to claim 8, it is characterised in that second predetermined condition is included in following condition extremely Few one kind:
    The first designated character is included in the class of the node;
    The second designated character is included in the identity of the node;
    The son node number of the node is less than predetermined son node number;
    And the length of the Text node contents of the node is less than predetermined content length, and in the Text nodes of the node The 3rd designated character is included in appearance.
  11. 11. device according to claim 7, it is characterised in that the blocking module, for by the display category of the node Property is arranged to show.
  12. 12. according to the devices described in claim 11, it is characterised in that described device further includes:
    Shroud module is asked, for when including picture in the node, shielding the universal resource locator according to the picture The resource request that URL is initiated.
  13. 13. a kind of Ad blocking device, it is characterised in that described device includes:
    Processor;
    For storing the memory of processor-executable instruction;
    Wherein, the processor is configured as:
    Event sniffer is added in the body nodes of the DOM Document Object Model of webpage, the event sniffer is directed to the webpage DOM Document Object Model body nodes on node insertion event monitored;
    After obtaining webpage loading, what what the event sniffer listened to be inserted into the DOM Document Object Model of the webpage Node;
    Detect whether the node is advertising node;
    If testing result is that the node is advertising node, the node is not shown.
CN201510106749.9A 2015-03-11 2015-03-11 Ad blocking method and device CN104778405B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510106749.9A CN104778405B (en) 2015-03-11 2015-03-11 Ad blocking method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510106749.9A CN104778405B (en) 2015-03-11 2015-03-11 Ad blocking method and device

Publications (2)

Publication Number Publication Date
CN104778405A CN104778405A (en) 2015-07-15
CN104778405B true CN104778405B (en) 2018-04-27

Family

ID=53619860

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510106749.9A CN104778405B (en) 2015-03-11 2015-03-11 Ad blocking method and device

Country Status (1)

Country Link
CN (1) CN104778405B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105701166B (en) * 2015-12-30 2019-07-23 Oppo广东移动通信有限公司 A kind of Ad blocking method and intercepting system
CN105956026B (en) * 2016-04-22 2019-08-02 北京小米移动软件有限公司 Webpage rendering method and device
CN106407262A (en) * 2016-08-24 2017-02-15 百度在线网络技术(北京)有限公司 Information display method and apparatus
WO2018058330A1 (en) * 2016-09-27 2018-04-05 中兴通讯股份有限公司 Method and apparatus for blocking advertisements, and browser and computer storage medium
CN108062324A (en) * 2016-11-08 2018-05-22 广州市动景计算机科技有限公司 Advertisement filter method, apparatus and user terminal
CN107016043A (en) * 2017-02-14 2017-08-04 阿里巴巴集团控股有限公司 A kind of information processing method and device
CN108628888A (en) * 2017-03-21 2018-10-09 中兴通讯股份有限公司 A kind of browser Ad blocking method, apparatus and terminal
CN107193889A (en) * 2017-05-02 2017-09-22 努比亚技术有限公司 Ad blocking method, terminal and computer-readable recording medium
CN107438075A (en) * 2017-08-08 2017-12-05 深圳市金立通信设备有限公司 A kind of method for preventing the page to be held as a hostage, terminal and computer-readable recording medium
CN108009232A (en) * 2017-11-29 2018-05-08 北京小米移动软件有限公司 Advertisement shields method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103052950A (en) * 2010-08-20 2013-04-17 惠普发展公司,有限责任合伙企业 Systems and methods for filtering web page contents
CN103605688A (en) * 2013-11-01 2014-02-26 北京奇虎科技有限公司 Intercept method and intercept device for homepage advertisements and browser
CN104133865A (en) * 2014-07-17 2014-11-05 可牛网络技术(北京)有限公司 Advertisement filtering method and device
CN104199915A (en) * 2014-08-29 2014-12-10 小米科技有限责任公司 Method and device for detecting webpage changes
CN104239369A (en) * 2013-06-24 2014-12-24 腾讯科技(深圳)有限公司 Method, device and system for filtering out webpage advertisements
CN104239422A (en) * 2014-08-21 2014-12-24 小米科技有限责任公司 Advertisement identification method, advertisement identification device and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103052950A (en) * 2010-08-20 2013-04-17 惠普发展公司,有限责任合伙企业 Systems and methods for filtering web page contents
CN104239369A (en) * 2013-06-24 2014-12-24 腾讯科技(深圳)有限公司 Method, device and system for filtering out webpage advertisements
CN103605688A (en) * 2013-11-01 2014-02-26 北京奇虎科技有限公司 Intercept method and intercept device for homepage advertisements and browser
CN104133865A (en) * 2014-07-17 2014-11-05 可牛网络技术(北京)有限公司 Advertisement filtering method and device
CN104239422A (en) * 2014-08-21 2014-12-24 小米科技有限责任公司 Advertisement identification method, advertisement identification device and electronic equipment
CN104199915A (en) * 2014-08-29 2014-12-10 小米科技有限责任公司 Method and device for detecting webpage changes

Also Published As

Publication number Publication date
CN104778405A (en) 2015-07-15

Similar Documents

Publication Publication Date Title
CN104238875B (en) Application program footmark adding method and device
CN104991789B (en) Application program open method and device
US9727348B2 (en) Providing a context-aware help content using a transparent overlay on a touch sensitive screen
CN106598630A (en) Key control method and apparatus, and terminal
CN105488112B (en) Information-pushing method and device
RU2631770C2 (en) Method and device for return to previously viewed page control
EP3171554B1 (en) Method and device for displaying a message
CN104166689B (en) The rendering method and device of e-book
CN104021350A (en) Privacy-information hiding method and device
CN104159275B (en) Method for connecting network and device
CN104572942A (en) Push message display method and push message display device
CN104469714B (en) Note transmission method and device
CN104079962B (en) A kind of method and device for pushing recommendation information
CN104793846A (en) Displaying method and device for interface of application program
CN104980580B (en) Short message inspection method and device
CN104731688B (en) Point out the method and device of reading progress
EP3242203A1 (en) Method for operating a display device and display device
CN104216742B (en) Brush machine control method and device based on password
CN104503689A (en) Method and device for displaying application interface
CN104331503B (en) The method and device of information push
EP2924593A1 (en) Method and apparatus for constructing documents
CN104965843B (en) A kind of method and device obtaining comment information
CN105549849A (en) Method and device for processing misoperation instruction
CN104156233A (en) Method, device and terminal for updating light applications in offline manner
CN104778063A (en) Method and device for updating resource

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant