Сценарии содержимого не перезагружаются при смене страницы - PullRequest
0 голосов
/ 16 сентября 2018

С расширением Chrome я хочу поместить кнопку в меню определенного веб-сайта со скриптами содержимого.Это работает, но когда я нажимаю на ссылку, которая перенаправляет на страницу этого сайта, кнопка не возвращается на страницу, пока я не нажму F5.Вот манифест:

{
"name": "osu!PlayButton",
"version": "1.0",
"description": "Launch the game from the website !",
"manifest_version": 2,
"content_scripts": [{
    "js": ["putTheButton.js"],
    "matches": ["https://osu.ppy.sh/home/*","https://osu.ppy.sh/community/*","https://osu.ppy.sh/rankings/*","https://osu.ppy.sh/store/*","https://osu.ppy.sh/help/*","https://osu.ppy.sh/beatmapsets/*","https://osu.ppy.sh/beatmaps/*","https://osu.ppy.sh/users/*"]
 }]
}

И скрипт putTheButton.js:

var menuAvatar = document.querySelector(".nav2-header .nav2__col--avatar");

var theContainer = document.createElement("div");
theContainer.className = "nav2__col";

var thePlayButton = document.createElement("a");
thePlayButton.className = "nav2__button nav2__button--stadium";
thePlayButton.setAttribute("href","osu://");
thePlayButton.innerHTML = "Play !";

theContainer.appendChild(thePlayButton);
menuAvatar.insertAdjacentElement("beforebegin",theContainer);

Спасибо за помощь!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...