So recently I wanted to block the comments section on a website however the element blocking was not working as they used random strings at the end of the div ID.

In this case the element appeared as:

###comment_iframe_65b14c04e9ff711034703604

Which when blocking will only block that page’s iframe and leave all the others appearing on other pages.

So to block the iframe properly, we have to use a wildcard, which normally would be *, meaning that

###comment_iframe_*

Would be blocked, however that doesn’t work since Adblock, Ublock etc use CSS selectors, so instead we have to use

##[id^="comment_iframe_"]

Which allow us to block everything after “iframe_”.

For more info on CSS selectors please see:

https://drafts.csswg.org/selectors-3/#attribute-substrings