I used to hide end screen cards in YouTube with code in the console, but it works until reloading or closing the tab. So, how can I import JavaScript code one time for all times?
Asked
Active
Viewed 157 times
0
-
What do you mean `code in Control`? Is Control some application? – CertainPerformance Mar 25 '21 at 02:58
-
My best guess is that you're trying to inject Javascript code into a website permanently every time you visit that website. You'll need a browser addon for this. Probably Greasemonkey or Tempermonkey (depending on which browser you use). – icecub Mar 25 '21 at 03:00
-
@CertainPerformance I write script in "Console" :)) – amg Mar 25 '21 at 03:05
-
1So do you mean `Control-V`? – CertainPerformance Mar 25 '21 at 03:06
-
The attention was due to a meta question. But which one? – Peter Mortensen Oct 18 '22 at 16:35
-
@PeterMortensen https://meta.stackoverflow.com/questions/420890/is-there-a-canonical-question-where-asker-doesnt-know-what-a-browser-extension?cb=1 – David McKee Oct 19 '22 at 13:48
1 Answers
1
If you don't want to type in and run a script every time you load a page, you can use a userscript instead. Userscript code runs automatically when a page matching the page you want loads. For example:
// ==UserScript==
// @name No Youtube Endcards
// @include /^https://youtube\.com/watch
// @grant none
// ==/UserScript==
console.log('Put your script here...');
You'll need a userscript manager like Tampermonkey. Install the addon, click on the "Create a new script" button, paste in the metadata block above, and then continue writing the JS as needed.

CertainPerformance
- 356,069
- 52
- 309
- 320