javascript - I want to remove iframe ads, but every time the ID value is refreshed, the following five English characters are changing?
我想大声告诉你
我想大声告诉你 2017-05-16 13:11:14
0
3
667

$("#iframe's ID").contents().find("#iframe's advertising ID").remove()
Originally, this code was used to remove ads that reference iframe, but each page The advertising id is updated as soon as it is refreshed. Cpg23241154qzkmv Cpg23241154ustep Cpg23241154gvhzk How to write to make this ID dynamic.

我想大声告诉你
我想大声告诉你

reply all(3)
迷茫

It seems that its ID is quite regular, basically starting with "Cpg", then the processing is as follows

$("#iframe的ID").contents().find('[id^="Cpg"]').remove();
巴扎黑

This kind of direct query for iframes excludes those in your own site and blocks all others, or you can determine whether the name of the iframe meets a certain rule and then block it

黄舟

If you can find a pattern, write a regular rule

It starts with Cpg, the middle 8 characters are always numbers, and the last 5 characters are lowercase letters:

^Cpg\d{8}[a-z]{5}$

Start with Cpg23241154, the last 5 are numbers or letters:

^Cpg23241154\w{5}$
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template