Coder Social home page Coder Social logo

pause 了 10 分钟,10 分钟之后还能正常刷 douyin,必须新开一个 douyin 页面才会被拦截,有办法解决吗? about chrome-url-block HOT 1 CLOSED

douseful avatar douseful commented on August 19, 2024
pause 了 10 分钟,10 分钟之后还能正常刷 douyin,必须新开一个 douyin 页面才会被拦截,有办法解决吗?

from chrome-url-block.

Comments (1)

ygweric avatar ygweric commented on August 19, 2024 1

目前是监听OnUpdatedChangeInfoType事件,也就是新开tab的事件内容,文档在这里 https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/onUpdated

When the user navigates to a new URL in a tab, this typically generates several onUpdated events as various properties of the tabs.Tab object are updated. This includes the url, but also potentially the title and favIconUrl properties. The status property will cycle through "loading" and "complete".

解决方法:插件开启,或者暂停时间到了以后,有个setTimoutOut方法,来iterate所有的tab,检测url匹配后关闭。

var tabs = await chrome.tabs.query({});
tabs.forEach(function (tab) {
  // do whatever you want with the tab
});

我个人认为这个需求比较小众吧,没必要监听当前页面,暂停(放松)过后,关闭抖音就行,开始工作,自动关闭不是太友好,万一再看关键内容呢,也意义不大。以后有相似需求我会加上。

from chrome-url-block.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.