Say I have two content scripts, codeA.js and codeB.js. I am wondering if it possible to run codeA.js on http://www.example.com and have codeB.js run on http://www.domain.com.
Would it be possible to set my content_scripts in the manifest.json file to:
"content_scripts": [
{
"matches": ["http://www.example.com", "http:www.domain.com"],
"js": ["codeA.js", "codeB.js"]
}
]
and then have each script check to see which URL the page currently sits at? If so, how would I go about doing this?
UPDATE:
I have tried using the following code
if(document.location == "http://*.google.com/*" || "https://*.google.com/*") {
alert("you are using google");
} else if(document.location == "http://*.yahoo.com/*" || "https://*.yahoo.com") {
alert("you are using yahoo!");
}
but I kept getting you are using google.