Removing Juejin Ads with a Tampermonkey Userscript
This guide explains how to create and inject a Tampermonkey userscript that hides both the top banner and article‑page advertisements on Juejin, adjusts the navigation layout, and restores the site’s original clean appearance for a better reading experience.
Juejin recently introduced intrusive advertisements that appear in the navigation bar and at the top of articles, disrupting the user experience for front‑end developers.
The solution is to write a simple CSS rule ( display: none; ) and inject it automatically using a Tampermonkey userscript each time the page loads.
Because hiding the top banner alone does not reposition the navigation bar, additional style adjustments are required to move the navigation elements back to their original locations and ensure proper layout during scrolling.
The complete userscript is provided below; it creates a <style> element, inserts the necessary CSS rules to hide the ads and correct the navigation positioning, and appends the style to the document head.
// ==UserScript==
// @name Juejin Ad Remover
// @namespace https://greasyfork.org/en/scripts/532890-掘金广告去除
// @version 0.2
// @description Hide Juejin ads and restore clean layout
// @author Allen-1998
// @match *://juejin.cn/*
// @license MIT
// @downloadURL https://update.greasyfork.org/scripts/532890/掘金广告去除.user.js
// @updateURL https://update.greasyfork.org/scripts/532890/掘金广告去除.meta.js
// ==/UserScript==
;(function () {
'use strict';
const head = document.querySelector('head');
const style = document.createElement('style');
style.setAttribute('type', 'text/css');
style.innerText = `
.top-banners-container,
.main-area.article-area > article > img {
display: none !important;
}
.view-container .with-global-banner .index-nav-before,
.view-container .with-global-banner .team-content .list-header.sticky,
.view-container .with-global-banner .user-view .list-header.sticky,
.view-container .with-global-banner .view-nav {
top: 5rem !important;
}
.header-with-banner,
.view-container .with-global-banner .index-nav-before.top,
.view-container .with-global-banner .team-content .list-header.sticky.top,
.view-container .with-global-banner .user-view .list-header.sticky.top,
.view-container .with-global-banner .view-nav.top {
top: 0 !important;
}
`;
head.append(style);
})();After installing the script from GreasyFork (or copying the code into your own Tampermonkey extension), the advertisements disappear and the navigation bar returns to its proper position, restoring Juejin’s original clean look.
The author notes that while advertising revenue is necessary for platform maintenance, excessive ads degrade user experience, and developers can help preserve the site’s simplicity by using such scripts.
Readers are encouraged to like, follow, and share feedback in the comments.
Rare Earth Juejin Tech Community
Juejin, a tech community that helps developers grow.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.