Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change a pop-up window's title using a Tampermonkey script?

Is there a way to use Tampermonkey to change the window title for a pop-up (child?) window? (This is for a streaming audio player)

Usually, we would use document.title to change the browser page/tab title for a webpage, but in this case it doesn't work. I believe that is because it is a pop-up spawned by the main webpage.

Is there a way to accomplish this via Tampermonkey.

This is the site with the pop-up I wish to modify. Click the "Listen Now" red button at top right and the pop-up will. I wish to change the title for that pop-up window.


References I tried/used:

  • https://www.sitepoint.com/community/t/changing-the-title-on-a-popup-window/2294/2
  • Set title in the window popup
like image 860
crashwap Avatar asked Nov 07 '22 01:11

crashwap


1 Answers

For the kind of popup given in your question, changing the title is simplicity itself. Merely set the script to run on the URL of the popup and then use document.title

Here is a complete working script that operates on the "Listen Now" popup of that page:

// ==UserScript==
// @name     _Change popup title
// @match    *://wibx950.com/listen-live/popup/
// @grant    none
// ==/UserScript==

document.title = "WKRP";

If you have a more intractable example, post a link/recipe to/for it.

like image 104
Brock Adams Avatar answered Nov 14 '22 22:11

Brock Adams