master
宇天 2020-11-04 17:59:31 +08:00
parent 924dd5bd0b
commit 09a2776dfa
6 changed files with 21 additions and 24 deletions

View File

@ -1,9 +1,12 @@
## DNS 缓存清除
> 一键清除chrome的DNS缓存, 并刷新当前选项卡。 web开发的利器。
## DNS缓存杀手
> DNS缓存杀手,一键清除chrome的DNS缓存, 并刷新当前选项卡。 web开发的利器。
### 更新日志
#### 2020/11/04 - v1.0.0
* 发布到chrome store。
#### 2018/07/29 - v0.3.0
* 兼容chrome 68+
* chrome 68+之后, 谷歌移除了原清除DNS的API方法, 所以只能通过打开`chrome://net-internals/#dns`页面, 进行js注入的方式来清除缓存。

View File

@ -1,28 +1,27 @@
/**
*
* @authors yutent (yutent@doui.cc)
* @date 2018-07-07 20:59:35
* @version $Id$
* DNS缓存杀手
* @author yutent<yutent.io@gmail.com>
* @date 2020/11/04 17:54:49
*/
chrome.browserAction.onClicked.addListener(function(ctab) {
let cid = ctab.id
let tid = null
let code = `
let script = document.createElement('script')
var cid = ctab.id
var tid = null
var code = `
var script = document.createElement('script')
script.textContent = \`
chrome.send('clearHostResolverCache')
chrome.send('flushSocketPools')
\`
document.body.appendChild(script)
`
let callback = function() {
var callback = function() {
chrome.tabs.remove(tid)
chrome.tabs.executeScript(cid, { code: 'location.reload()' })
}
chrome.tabs.query({}, function(tabs) {
let done = false
var done = false
for (let i = 0, tab; (tab = tabs[i++]); ) {
if (/^chrome:\/\/net-internals/.test(tab.url)) {
tid = tab.id

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,9 +1,8 @@
{
"manifest_version": 2,
"name": "DNS Flush",
"description": "一键清除chrome的DNS缓存, 并刷新当前选项卡。 web开发的利器。",
"version": "0.3",
"name": "dns-killer",
"description": "DNS缓存杀手,一键清除chrome的DNS缓存, 并刷新当前选项卡。 web开发的利器。",
"version": "1.0.0",
"author": "yutent",
"icons": {
"64": "icon64.png",
@ -11,15 +10,11 @@
"256": "icon256.png"
},
"background": {
"scripts": [ "background.js" ]
},
"scripts": ["background.js"]
},
"browser_action": {
"default_icon": "icon64.png"
},
"permissions": [
"tabs",
"chrome://net-internals/#dns",
"*://*/*"
],
"homepage_url": "https://doui.cc"
"permissions": ["tabs", "chrome://net-internals/#dns", "*://*/*"],
"homepage_url": "https://yutent.me"
}