Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
How to Make popup.html on specific URL

PopUp.html doesn't work on specific URL I want to enable popup.html to open on a specific URL just Like google.com for example

Manifest.json v3

{
  "name": "test",
  "version": "1.0",
  "description": "My Extension",
  "manifest_version": 3,
  "content_scripts": [
    {
      "matches": ["https://www.google.com/*"],
      "js": ["popup.js"],
      "css": ["style.css"]
    }
  ],"action": { 
      "default_popup" : "Popup.html"
    }
}

I tried with MV2 but it can't work inside the if condition()

Manifest.json v2

{
  "name": "testmv2",
  "version": "1.0",
  "description": "My Extension 2",
  "manifest_version": 2,
  "permissions": ["activeTab","tabs", "declarativeContent"],
      "background":{        
      "scripts": ["background.js"],
      "persistent": false
    },
  "content_scripts": [
    {
      "matches": ["https://www.google.com/*"],
      "js": ["popup.js"],
      "css": ["style.css"]
    }
  ],    "browser_action": { }
}

Backgound.js

document.addEventListener('DOMContentLoaded', function() {

'use strict';

chrome.tabs.getSelected(null, function(tab) {
    myFunction(tab.url);
});

function myFunction(tablink) {
var mySiteUrl = 'https://www.google.com/';

    if( tablink === mySiteUrl){
        //it's the right website
        chrome.browserAction.setPopup({popup: "Popup.html"});

    }
}
})
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!