0

I want to make a script that among other things, will close the current tab, I found these: How to close current tab in a browser window?, Close Current Tab, but all of the answers there are obsolete and don't work in Chrome 44 (latest).

Is it really impossible to do? Maybe there's another way that doesn't involve javascript or greasemonkey to do it ?

Just to make sure I'm not doing something wrong with the syntax (I'm a total beginner in javascript), this is an example test code I have in tampermonkey (it should close youtube tabs when opening them):

// ==UserScript==
// @name         My Fancy New Userscript
// @namespace    http://your.homepage/
// @version      0.1
// @description  enter something useful
// @author       You
// @grant        none
// @include       http://*.youtube.com/*
// @include       http://youtube.com/*
// @include       https://*.youtube.com/*
// @include       https://youtube.com/*
// ==/UserScript==

window.close();
Community
  • 1
  • 1
shinzou
  • 5,850
  • 10
  • 60
  • 124
  • It doesn't close the tab when I go to youtube.com @ᔕᖺᘎᕊ – shinzou Aug 23 '15 at 17:36
  • @ᔕᖺᘎᕊ oh you deleted everything... Do you think there may be another way to close a tab? Does an extension have more privileges? – shinzou Aug 23 '15 at 17:51
  • 1
    See the linked question. For Chrome only, try *injecting* `open(location, '_self').close();`. If that doesn't work then, yes, an extension does have much more privileges and can close windows. – Brock Adams Aug 23 '15 at 17:55

0 Answers0