0

我试图建立一个Chrome扩展为我公司与我们使用的项目管理系统使用,大本营Chrome扩展程序不开火内页

在大本营的初始加载,警报显示,但是当我正在浏览网站,我不再看到警报。

MANIFEST.JS

{ 
    "manifest_version": 2, 
    "name": "BaseCamp Signature", 
    "description": "This extension adds signature to Basecamp", 
    "version": "1.0", 
    "browser_action": { 
     "default_icon": "icon.png", 
     "default_popup": "popup.html", 
     "default_title": "Title!" 
    }, 
    "permissions": [ 
     "storage", 
     "activeTab", 
     "tabs", 
     "https://3.basecamp.com/*"  
    ], 
    "content_scripts": [ 
     { 
      "matches": ["https://3.basecamp.com/*"], 
      "all_frames": true, 
      "js": ["content.js"], 
      "run_at": "document_end" 
     } 
    ] 
} 

内容JS

alert('bingo'); 

正如我在清单中使用matches: ["https://*/*"]测试,虽然这将触发对所有站点,StackOverflow上的内页包括在内,甚至这种方法在浏览BaseCamp的内部页面时都不会触发

与往常一样,任何帮助将不胜感激

+1

也许BaseCamp只需更新网址并以编程方式更改页面内容,就像YouTube一样。 –

+0

有趣,意思就像在后台运行的React一样? –

+1

React只是一个框架。我的意思是使用本机api:https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState()_method –

回答

-1

通过存储当前的URL和检查每半秒,看它是否已经改变,我能在每个URL更新运行我的分机

var currentPage = window.location.href; 

// listen for changes 
setInterval(function() { 
    if (currentPage != window.location.href) { 
     // page has changed, set new page as 'current' 
     currentPage = window.location.href; 
     alert('double bingo'); 
    } 
}, 500);