最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is there a way to change the tab title in private mode? - Stack Overflow

programmeradmin2浏览0评论

I want to make a custom landing page for when I open a new private tab. Manage to do it in normal tab with a custom extension:

{
  "manifest_version": 3,
  "name": "Black Background New Tab",
  "version": "1.0",
  "description": "Changes the background color of new tabs to black.",
  "permissions": ["tabs", "activeTab", "storage"],
  "chrome_url_overrides": {
    "newtab": "newtab.html"
  },
  "host_permissions": ["<all_urls>"],
  "incognito": "spanning"
}

newtab.html:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>────────────────────────────────────────────</title>
  <style>
    <-- some style here
  </style>
</head>
<body>
  <-- some code here
</body>
</html>

But I cannot make it work in private windows/tabs.

I want to make a custom landing page for when I open a new private tab. Manage to do it in normal tab with a custom extension:

{
  "manifest_version": 3,
  "name": "Black Background New Tab",
  "version": "1.0",
  "description": "Changes the background color of new tabs to black.",
  "permissions": ["tabs", "activeTab", "storage"],
  "chrome_url_overrides": {
    "newtab": "newtab.html"
  },
  "host_permissions": ["<all_urls>"],
  "incognito": "spanning"
}

newtab.html:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>────────────────────────────────────────────</title>
  <style>
    <-- some style here
  </style>
</head>
<body>
  <-- some code here
</body>
</html>

But I cannot make it work in private windows/tabs.

Share Improve this question edited Jan 19 at 13:28 jonrsharpe 122k30 gold badges266 silver badges473 bronze badges asked Jan 19 at 13:24 Laplace'sDemonLaplace'sDemon 1281 gold badge1 silver badge7 bronze badges 0
Add a comment  | 

2 Answers 2

Reset to default 0

Here's similar question: Can you determine if Chrome is in incognito mode via a script?

The FileSystem API is disabled in incognito mode.

Solved. Manifest.json:

 {
  "manifest_version": 3,
  "name": "Custom Private New Tab",
  "version": "1.0",
  "description": "Customizes the new private tab page.",
  "permissions": ["tabs", "activeTab"],
  "chrome_url_overrides": {
    "newtab": "newtab.html"
  },
  "incognito": "split",
  "background": {
    "service_worker": "background.js"
  }
}

Background.js:

chrome.runtime.onInstalled.addListener(() => {
    console.log('Extension installed and background script running.');
  });

And the newtab.html, only change to show personal data.

发布评论

评论列表(0)

  1. 暂无评论