Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "content_scripts": [{
- "matches": ["http://myUrl1.com/*"],
- ...
- }]
- "content_scripts": [{
- "matches": [ "http://*/*", "https://*/*" ],
- ...
- }]
- "permissions": [
- ...
- "http://*/*"
- "https://*/*"
- ],
- "background": {
- "scripts": ["background.js"]
- },
- ...
- const ALLOWED_URL = '...'; // Разрешенный URL
- // отслеживаем изменение во вкладках
- chrome.tabs.onUpdated.addListener(function(tabId, changeInfo) {
- if(changeInfo.status === 'completed' && changeInfo.url === ALLOWED_URL) {
- // запускаем content-script
- chrome.tabs.executeScript(tabId, {
- file: 'content-script.js'
- });
- }
- });
Add Comment
Please, Sign In to add comment