user3399738
user3399738

Reputation: 35

Injection scripts in Safari extensions don't fire in Youtube

While creating a Safari extension, I tried adding an End Script on Youtube pages. The script runs when the first Youtube page loads. The problem is that if I click any of the Youtube links in the page, nothing happens. However, if I open the link in a new tab, it works like a charm. Any idea why this happens?

The code is just a simple alert:

if (window.top === window) {
    alert("Hello World");
}

and the pattern I used for the Allowed Domains is:

*.youtube.com

Upvotes: 0

Views: 227

Answers (1)

Kimo
Kimo

Reputation: 185

Youtube is a single page application. It loads required parts via XHR without reloading the page.

You can use dom mutation events to detect changes.

Upvotes: 1

Related Questions