3

I try to remove the 8 tiles with the last seen pages on the start page of Chrome. You know, the page which appears if you start Chrome.

But since there is no URL at all, I don't know what I have to enter at @match. I've tried // @match * but the script is not executed.

// ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match * // @grant none // ==/UserScript== (function() { 'use strict'; setInterval(function(){ var box = document.getElementById("mv-tiles"); box.remove(); },10 ); })(); 
1
  • 1
    Setting // @match *://*/_/chrome/newtab* seems to work. Commented Jan 24, 2017 at 22:04

1 Answer 1

2

Use @include instead of @match.

Also, it's possible to get the URL by going to the console and running window.location.href

I tried this and it worked:

// @include http*://*chrome/newtab* 

Maybe don't use an interval there, since it'll keep throwing errors once the element is not there anymore.

I'd use something like this:

injectStyles('#mv-single {display: none;}'); function injectStyles (styles) { var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = styles; document.head.appendChild(style); } 
Sign up to request clarification or add additional context in comments.

2 Comments

Yes you are correct, it also works without the interval.
I have to unaccept this answer as solution since it does not work anymore.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.