I'm making a chrome extension that adds some HTML to a page. If you open the page it works fine, except that if you change routes within the same website. It'll re-get the HTML for the site, but my content script won't be called again to add out custom HTML. What is the best way to re-call the content script when the route changes?
const title = document.querySelector('#about_main > div:nth-child(1) > h1');
const button = "<button style="margin-left:5px;border:none;background:none;color:#1f80c3;"></></button>";
const trackUserId = window.GameManager.settings.track.u_url; //Gets the author's user id
const userId = window.GameManager.settings.user.u_name; //Gets the logged in user id
const text = title.textContent;
if (trackUserId === userId) {
console.log('match!');
title.innerHTML = text + button;
} else {
console.log('no match!');
}
Thanks!