1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

とある環境でとある広告を読み込むとbrowserが死ぬ

Posted at

と言っても必ず撃沈(沈黙)するわけではない。qiita等で広告があるpageではchrome様は[x_x]などという間抜け面を晒して下さる事がある。まあ広告が原因だとは断言できないが、我が流派は確信しているらしい。
再現した環境はWindows7 chrome 109.0.5414.120である。役に立つかどうか分からないが、以下のようなbookmarkletを召喚して対策してみる

iframe殲滅
javascript:void%20function(a){for(a%20of[...document.getElementsByTagName("iframe")])a.outerHTML=null}()
script滅殺
javascript:void%20function(a){for(a%20of[...document.scripts])a.outerHTML=null}()

bookmarkletを連打するのだ!

余談

ところで以下のscriptは全く異なる動作をするが、挙動の違いがわかるだろうか?

<a href>A</a><a href>B</a><a href>C</a><a href>D</a>
<script>
for(let a of document.links)a.outerHTML=""
</script>
<a href>A</a><a href>B</a><a href>C</a><a href>D</a>
<script>
for(let a of[...document.links])a.outerHTML=""
</script>

なんと前者はa要素が生き残り、後者は全滅するのである! ちなみに前者の場合は偶数番目が死に、奇数番目が生存。…さて、説明してもらおうか(しない)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?