Greasy Fork is available in English.

Дискусии » Разработка

Match rule for www

§
Публикуван на: 01.06.2023

Please help me getting the equivalent of `// @include *://www.*` as `match`

§
Публикуван на: 01.06.2023
// ==UserScript==
// @name          www test
// @description   www test
// @version       -1
// @match         *://*/*
// @grant         none
// ==/UserScript==

(function() {
  'use strict';

  if (location.host.split('.')[0] !== 'www') return;

  alert('works');
})();

OR location.host.startsWith('www.')

§
Публикуван на: 19.06.2023

Thank you gentlemen.

I'm curious to know, is it even possible to have a match rule for subdomains?

Even that chat bot, a friend here suggested, didn't provide any working match rule.

But I did further tested that bot, just to be fair, and it did a great job with RegEx, and it even explained the rules which I did find to be good.

Публикувайте отговор

Влезте, за да публикувате отговор.