JavaScript "load" event listener is not triggered when page is visited from a relative path link

227 Views Asked by At

I wrote a chrome extension that runs a function called find_agent, on every page load. However, when navigating between the site pages the function is not called again, unless refreshing the destination page. All pages have the same domain.

manifest.js:

{
"name": "FindAgent",
"version": "0.99",
"manifest_version": 2,
"content_scripts" : [
    {
        "matches": ["https://www.[DOMAIN HIDDEN].com/[PATH HIDDEN]*"],
        "js": ["find_agent.js"],
        "css": ["style.css"]
    }
]}

find_agent.js:

function find_agent()
{
   ...
}
window.addEventListener('load', function ()
{
    find_agent()
})
0

There are 0 best solutions below