Skip to content

Loading…

Line blocking [Feature] #1397

Open
davidhedlund opened this Issue · 6 comments

4 participants

@davidhedlund

@chrisaljoudi One way to block inline scripts as long as the lines above the generated HTML page remains intact, would be to specify which lines to block by adding a new predefined variable: $line.

Example of syntax to add to block line 7-46: ||youtube.com^$line=7-14

I'm sure line blocking is even more useful in other circumstances.

@seanrand

David, that's not a good idea. It would be ridiculously volatile if the page source changes in any way and would result in completely undefined page breakage.
What are the actual use cases you're trying to solve with this?

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>
<p>My first spam.</p>

</body>
</html>

example$line=8

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>
<!--<p>My first spam.</p>-->

</body>
</html>

Now say the page source changes in any way (as it does very often on websites).
For example:

<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>

<p>My first paragraph.</p>
<p>My first spam.</p>
</body>
</html>

Which would result in this:

<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>

<p>My first paragraph.</p>
<p>My first spam.</p>
<!--</body>-->
</html>

Now what?

Again, when you're proposing features, what are the actual use cases you're trying to solve that aren't possible to do right now? Provide actual website links and show us the ads that can't be blocked with what we have right now.

@davidhedlund

@seanrand HTML in <head> is updated less frequently than HTML in <body>. Therefore customized inline-scripts ( <script type="text/javascript">) can be blocked this way. You might want certain inline-scripts to be used but not others.

@seanrand

Content in <head> might change just as often if there are scripts inlined in it.
Believe me, "blocking" based on line numbers in the generated HTML definitely isn't the way to go.

You're probably looking for something like AdGuard's HTML Filtration rules to block certain inlined scripts.

See also: #1354

@davidhedlund

@seanrand Thank you for your suggestion, it is being discussed in #1354.

@flyingzebras

Line blocking would be useful in my opinion, it can be used as a work around to the pop-up URL redirection issue described in https://issues.adblockplus.org/ticket/2095#comment:16

Some of the most popular sites require certain <script type="text/javascript"> inline script portions while other <script type="text/javascript"> inline scripts on the same site act as malvertiser. @chrisaljoudi @davidhedlund @seanrand

Please read

@seanrand seanrand referenced this issue in gorhill/uBlock
Open

Blocking meta refresh redirects #226

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.