Youtube does not trigger injection scripts in Safari extensions

During my work on a Safari extension, I encountered an issue with adding an End Script to Youtube pages. The script functions properly when the initial Youtube page loads, but if I click any links within the page, nothing happens unless I open them in a new tab. Any explanation for this behavior?

The code snippet is quite simple and just displays an alert:

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

For the Allowed Domains, I followed the pattern:

*.youtube.com

Answer №1

One interesting feature of Youtube is that it operates as a single page application, loading necessary components through XHR instead of refreshing the entire page.

An effective way to track changes on Youtube is by utilizing dom mutation events.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The Meteor update is unsuccessful on the Mongo Sub Collection and will not continue

I am currently facing an issue with updating a specific object within an array in my object based on a value. Whenever I try to add the update code, the function gets stuck at that point without proceeding further. None of the console.log calls after the u ...

Utilizing the closest method to retrieve the form element

As I review code written by another developer, I came across a surprising method used to retrieve a form object. HTML for Login Form <form id="frm_login" action=""> <input type="text" name="username" id="username"> <input type="passwor ...

What is the best way to use jQuery AJAX to efficiently upload a file to a PHP page

Attempting to write some JavaScript code along with AJAX for file sending technology. Here is the HTML form code: <form action="" method="post" id="contact_form" enctype="multipart/form-data"> <input type="text" name="name" id="name"> < ...

Encountering issues with $.AJAX post in JavaScript, while successful in Advanced Rest Client

My JavaScript code is facing an issue when trying to communicate with the HttpPost service. Interestingly, I can access the same endpoint using the "Advanced Rest Client Application" for Chrome without any problems. However, when I execute my code in the C ...

Error in Flask app: Stripe Elements - "400 bad request: CSRF token not found or invalid"

Currently, I am in the process of following the Stripe Quickstart guide for integrating stripe Elements with Flask. While working through the tutorial available at https://stripe.com/docs/stripe-js/elements/quickstart, I encountered an issue - the token ap ...

Function cannot be triggered by pressing the ENTER key

I'm struggling to pass values to my function and make it run when I press the ENTER KEY in PHP The function I'm dealing with is called update() Below is the PHP code snippet: echo '<input type="text" size="23" id= n'.$row["Cont ...

What is the method of aligning content to the left side in a slick slider?

My slider is set up to display three elements, but I'm having trouble aligning one or two elements to the left instead of centering them. jQuery(function () { jQuery('.slider-blog').slick({ arrows: false, dots: true, ...

Issues arise with AngularJS showing images fetched from an API

Currently, I am facing an issue where I am trying to display images from a REST API but keep receiving a "error 403" message. Here is the link to my JSFiddle. Please take a look, as I have attempted using both <img src=""> and ng-src='', bu ...

Retrieve the parent node's class using JavaScript without relying on jQuery

Attempting to retrieve the class of the parent node of a selected element using JavaScript, but encountering issues with the following code snippet. Any guidance on what needs to be corrected? function getParentNodeClass() { var parentNodeClass = this.p ...

The useEffect hook is triggering multiple unnecessary calls

Imagine a tree-like structure that needs to be expanded to display all checked children. Check out this piece of code below: const { data } = useGetData(); // a custom react-query hook fetching data from an endpoint Now, there's a function that fin ...

Should I consolidate all my .js files into one file - worth considering?

On my site Pure Words, I currently have multiple scripts. Should I consolidate them into a single file or maintain them as separate entities? ...

CSS for positioning tabs by sliding

Can someone assist me with properly positioning my Sliding TAB? It appears fine in my browser, but on other computers with varying resolutions, it overlaps with another tab. If you'd like to view the site, click this LINK Below is the code I am usin ...

Synchronizing two navigation menus on a single-page application website

Let me start by saying that I specialize in back end development and am facing a specific challenge with building a website that includes two navigation menus. The main navigation menu features links like Home, while the sub-navigation menu includes option ...

What is the best way to extract data from a table and transmit it to the server using AngularJS?

I'm attempting to extract all the content from a table in HTML. Is it possible to retrieve all rows from one side and send them in a post request to the server? I've been struggling to figure out how to do this. Do I need to bind each row using n ...

Trouble accessing the Ionic SQLite database: Unable to open

I encountered some errors while attempting to connect my ionic app to a database. I am currently running the app on an android device using Google Chrome DevTools to troubleshoot the issue. Check out the createDatabase() function and the specific error th ...

Angular 2 table fails to refresh after callback updates collection, but a timer update triggers a full refresh of the collection

I am experiencing an issue with updating a string[] collection from the Observable subscription: heroes:string[] = ['milan']; // this works fine let current = this; (function theLoop (i: number) { setTimeout(() => { current.heroe ...

Employ JavaScript to tally up the number of checkboxes that are checked within a web table

Here is some HTML code: <table id="tblPortfolio"> <tbody role="alert" aria-live="polite" aria-relevant="all"> <tr class="even"> <td class=" sorting_1"> </td> <tr class="odd"> <td class=" sorting_1"> <input typ ...

Utilizing a JavaScript variable as an argument in Fluid URI ViewHelper: A step-by-step guide

I am trying to create an Ajax call from a Fluid template using the Fluid URI action ViewHelper. However, I am facing an issue where one of the arguments needs to be dynamically obtained from a Javascript variable. How can I ensure that the ViewHelper is re ...

Utilizing NLP stemming on web pages using JavaScript and PHP for enhanced browsing experience

I've been exploring how to incorporate and utilize stemming results with JavaScript and PHP pages on web browsers. After running node index.js in the VS Code terminal, I was able to retrieve the output word using the natural library: var natural = re ...

Unexpected behavior occurs when ajax is added to an array for jQuery promise results

In my code, I have an each loop that makes individual AJAX requests and stores them in an array like this: var promises = []; $items.each(function(k, v) { promises.push( $.ajax({ url: ..., .... }) ); }); $.when.app ...