Why the content script execution does not continue after 2 reloads?
I've been making an extension to always win in www.frikitrivial.com. All the mechanics are in the content script file, it has to reload the page each time the url of the tab is equal to "http://www.frikitrivial.com/end.php", but after doing that 2 times, it stops, I means, the content script does not execute anymore. I have checked this writing a console.log() at the beginning of the script.
Thanks.
This is the code from the content script file (you can ignore the most of it).
console.log( "Iniciando partida..." )
let question, answers, _answers
if( location.href !== "http://www.frikitrivial.com/end.php" ){
question = document.querySelectorAll("div.question")[0].textContent
answers =
_answers = document.querySelectorAll("a.answer")
document.querySelectorAll("a.answer").forEach( e => answers.push( e.textContent ) )
}
function click( s ) {
let c
for( let i = 0; i < 4; i++ ) {
if( s === _answers[i].textContent ) {
c = _answers[i]
}
}
console.log( "El siguiente elemento va a ser clickado..." )
console.log( c )
c.click()
}
chrome.storage.sync.get(["lastClicked"], function(result){
if( result.lastClicked ) {
console.log( "Leido lastClicked..." )
if( location.href === "http://www.frikitrivial.com/end.php" ) { // manejamos fallo
console.log( "Manejando fallo de pregunta..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers.shift(),
answered: false
}
}, () => chrome.runtime.sendMessage({redirect: "https://www.frikitrivial.com/game.php"}))
} else { // actualizamos el estado de la ultima pregunta respondida
if( !result.lastClicked.answered ){
console.log( "Manejando lastClicked not answered..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers,
answered: true
}
}, answerNewQuestion)
} else {
console.log( "Manejando lastClicked answered..." )
answerNewQuestion()
}
}
} else {
answerNewQuestion()
}
})
function answerNewQuestion() {
chrome.storage.sync.get([question], function(result){
if( result.question ) { // si ya hemos intentado responder esta pregunta alguna vez
if( result.question.answered ) {
chrome.storage.sync.set( {
[result.question]: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
} else {
chrome.storage.sync.set( {
lastClicked: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
}
} else {
chrome.storage.sync.set( {
[question]: {
question: question,
answers: answers,
answered: false
}
}, function( result ){
chrome.storage.sync.set( {
lastClicked: {
question: question,
answers: answers,
answered: false
}
}, () => click( answers[0] ) )
})
}
})
}
And here is the manifest.json!
{
"name": "Getting Started Example",
"version": "1.0",
"description": "Build an Extension!",
"permissions": [
"activeTab",
"declarativeContent",
"storage",
"unlimitedStorage"
],
"background": {
"scripts": ["background.js"],
"persistent": true
},
"page_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
}
},
"icons": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
},
"content_scripts": [
{
"matches": ["http://www.frikitrivial.com/game.php*", "http://www.frikitrivial.com/end.php"],
"js": ["contentScript.js"]
}
],
"manifest_version": 2
}
javascript google-chrome google-chrome-extension google-chrome-devtools
add a comment |
I've been making an extension to always win in www.frikitrivial.com. All the mechanics are in the content script file, it has to reload the page each time the url of the tab is equal to "http://www.frikitrivial.com/end.php", but after doing that 2 times, it stops, I means, the content script does not execute anymore. I have checked this writing a console.log() at the beginning of the script.
Thanks.
This is the code from the content script file (you can ignore the most of it).
console.log( "Iniciando partida..." )
let question, answers, _answers
if( location.href !== "http://www.frikitrivial.com/end.php" ){
question = document.querySelectorAll("div.question")[0].textContent
answers =
_answers = document.querySelectorAll("a.answer")
document.querySelectorAll("a.answer").forEach( e => answers.push( e.textContent ) )
}
function click( s ) {
let c
for( let i = 0; i < 4; i++ ) {
if( s === _answers[i].textContent ) {
c = _answers[i]
}
}
console.log( "El siguiente elemento va a ser clickado..." )
console.log( c )
c.click()
}
chrome.storage.sync.get(["lastClicked"], function(result){
if( result.lastClicked ) {
console.log( "Leido lastClicked..." )
if( location.href === "http://www.frikitrivial.com/end.php" ) { // manejamos fallo
console.log( "Manejando fallo de pregunta..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers.shift(),
answered: false
}
}, () => chrome.runtime.sendMessage({redirect: "https://www.frikitrivial.com/game.php"}))
} else { // actualizamos el estado de la ultima pregunta respondida
if( !result.lastClicked.answered ){
console.log( "Manejando lastClicked not answered..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers,
answered: true
}
}, answerNewQuestion)
} else {
console.log( "Manejando lastClicked answered..." )
answerNewQuestion()
}
}
} else {
answerNewQuestion()
}
})
function answerNewQuestion() {
chrome.storage.sync.get([question], function(result){
if( result.question ) { // si ya hemos intentado responder esta pregunta alguna vez
if( result.question.answered ) {
chrome.storage.sync.set( {
[result.question]: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
} else {
chrome.storage.sync.set( {
lastClicked: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
}
} else {
chrome.storage.sync.set( {
[question]: {
question: question,
answers: answers,
answered: false
}
}, function( result ){
chrome.storage.sync.set( {
lastClicked: {
question: question,
answers: answers,
answered: false
}
}, () => click( answers[0] ) )
})
}
})
}
And here is the manifest.json!
{
"name": "Getting Started Example",
"version": "1.0",
"description": "Build an Extension!",
"permissions": [
"activeTab",
"declarativeContent",
"storage",
"unlimitedStorage"
],
"background": {
"scripts": ["background.js"],
"persistent": true
},
"page_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
}
},
"icons": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
},
"content_scripts": [
{
"matches": ["http://www.frikitrivial.com/game.php*", "http://www.frikitrivial.com/end.php"],
"js": ["contentScript.js"]
}
],
"manifest_version": 2
}
javascript google-chrome google-chrome-extension google-chrome-devtools
I like to start debugging this sort of problem by commenting out almost the entire file except for the console.log statement and then running it, just to verify for certain that the problem has nothing to do with the content of the file itself.
– temporary_user_name
Nov 19 '18 at 12:08
1
You didn't show your manifest.json so I have to guess what happens on the third time. 1) Maybe the URL is different, which doesn't match"matches"
in manifest.json. 2) Maybe the page is using "soft" navigation via History API or by changing the hash (URL fragment)
– wOxxOm
Nov 19 '18 at 12:17
I'm going to add it wait!
– Antonio Gamiz Delgado
Nov 19 '18 at 12:28
add a comment |
I've been making an extension to always win in www.frikitrivial.com. All the mechanics are in the content script file, it has to reload the page each time the url of the tab is equal to "http://www.frikitrivial.com/end.php", but after doing that 2 times, it stops, I means, the content script does not execute anymore. I have checked this writing a console.log() at the beginning of the script.
Thanks.
This is the code from the content script file (you can ignore the most of it).
console.log( "Iniciando partida..." )
let question, answers, _answers
if( location.href !== "http://www.frikitrivial.com/end.php" ){
question = document.querySelectorAll("div.question")[0].textContent
answers =
_answers = document.querySelectorAll("a.answer")
document.querySelectorAll("a.answer").forEach( e => answers.push( e.textContent ) )
}
function click( s ) {
let c
for( let i = 0; i < 4; i++ ) {
if( s === _answers[i].textContent ) {
c = _answers[i]
}
}
console.log( "El siguiente elemento va a ser clickado..." )
console.log( c )
c.click()
}
chrome.storage.sync.get(["lastClicked"], function(result){
if( result.lastClicked ) {
console.log( "Leido lastClicked..." )
if( location.href === "http://www.frikitrivial.com/end.php" ) { // manejamos fallo
console.log( "Manejando fallo de pregunta..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers.shift(),
answered: false
}
}, () => chrome.runtime.sendMessage({redirect: "https://www.frikitrivial.com/game.php"}))
} else { // actualizamos el estado de la ultima pregunta respondida
if( !result.lastClicked.answered ){
console.log( "Manejando lastClicked not answered..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers,
answered: true
}
}, answerNewQuestion)
} else {
console.log( "Manejando lastClicked answered..." )
answerNewQuestion()
}
}
} else {
answerNewQuestion()
}
})
function answerNewQuestion() {
chrome.storage.sync.get([question], function(result){
if( result.question ) { // si ya hemos intentado responder esta pregunta alguna vez
if( result.question.answered ) {
chrome.storage.sync.set( {
[result.question]: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
} else {
chrome.storage.sync.set( {
lastClicked: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
}
} else {
chrome.storage.sync.set( {
[question]: {
question: question,
answers: answers,
answered: false
}
}, function( result ){
chrome.storage.sync.set( {
lastClicked: {
question: question,
answers: answers,
answered: false
}
}, () => click( answers[0] ) )
})
}
})
}
And here is the manifest.json!
{
"name": "Getting Started Example",
"version": "1.0",
"description": "Build an Extension!",
"permissions": [
"activeTab",
"declarativeContent",
"storage",
"unlimitedStorage"
],
"background": {
"scripts": ["background.js"],
"persistent": true
},
"page_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
}
},
"icons": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
},
"content_scripts": [
{
"matches": ["http://www.frikitrivial.com/game.php*", "http://www.frikitrivial.com/end.php"],
"js": ["contentScript.js"]
}
],
"manifest_version": 2
}
javascript google-chrome google-chrome-extension google-chrome-devtools
I've been making an extension to always win in www.frikitrivial.com. All the mechanics are in the content script file, it has to reload the page each time the url of the tab is equal to "http://www.frikitrivial.com/end.php", but after doing that 2 times, it stops, I means, the content script does not execute anymore. I have checked this writing a console.log() at the beginning of the script.
Thanks.
This is the code from the content script file (you can ignore the most of it).
console.log( "Iniciando partida..." )
let question, answers, _answers
if( location.href !== "http://www.frikitrivial.com/end.php" ){
question = document.querySelectorAll("div.question")[0].textContent
answers =
_answers = document.querySelectorAll("a.answer")
document.querySelectorAll("a.answer").forEach( e => answers.push( e.textContent ) )
}
function click( s ) {
let c
for( let i = 0; i < 4; i++ ) {
if( s === _answers[i].textContent ) {
c = _answers[i]
}
}
console.log( "El siguiente elemento va a ser clickado..." )
console.log( c )
c.click()
}
chrome.storage.sync.get(["lastClicked"], function(result){
if( result.lastClicked ) {
console.log( "Leido lastClicked..." )
if( location.href === "http://www.frikitrivial.com/end.php" ) { // manejamos fallo
console.log( "Manejando fallo de pregunta..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers.shift(),
answered: false
}
}, () => chrome.runtime.sendMessage({redirect: "https://www.frikitrivial.com/game.php"}))
} else { // actualizamos el estado de la ultima pregunta respondida
if( !result.lastClicked.answered ){
console.log( "Manejando lastClicked not answered..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers,
answered: true
}
}, answerNewQuestion)
} else {
console.log( "Manejando lastClicked answered..." )
answerNewQuestion()
}
}
} else {
answerNewQuestion()
}
})
function answerNewQuestion() {
chrome.storage.sync.get([question], function(result){
if( result.question ) { // si ya hemos intentado responder esta pregunta alguna vez
if( result.question.answered ) {
chrome.storage.sync.set( {
[result.question]: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
} else {
chrome.storage.sync.set( {
lastClicked: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
}
} else {
chrome.storage.sync.set( {
[question]: {
question: question,
answers: answers,
answered: false
}
}, function( result ){
chrome.storage.sync.set( {
lastClicked: {
question: question,
answers: answers,
answered: false
}
}, () => click( answers[0] ) )
})
}
})
}
And here is the manifest.json!
{
"name": "Getting Started Example",
"version": "1.0",
"description": "Build an Extension!",
"permissions": [
"activeTab",
"declarativeContent",
"storage",
"unlimitedStorage"
],
"background": {
"scripts": ["background.js"],
"persistent": true
},
"page_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
}
},
"icons": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
},
"content_scripts": [
{
"matches": ["http://www.frikitrivial.com/game.php*", "http://www.frikitrivial.com/end.php"],
"js": ["contentScript.js"]
}
],
"manifest_version": 2
}
console.log( "Iniciando partida..." )
let question, answers, _answers
if( location.href !== "http://www.frikitrivial.com/end.php" ){
question = document.querySelectorAll("div.question")[0].textContent
answers =
_answers = document.querySelectorAll("a.answer")
document.querySelectorAll("a.answer").forEach( e => answers.push( e.textContent ) )
}
function click( s ) {
let c
for( let i = 0; i < 4; i++ ) {
if( s === _answers[i].textContent ) {
c = _answers[i]
}
}
console.log( "El siguiente elemento va a ser clickado..." )
console.log( c )
c.click()
}
chrome.storage.sync.get(["lastClicked"], function(result){
if( result.lastClicked ) {
console.log( "Leido lastClicked..." )
if( location.href === "http://www.frikitrivial.com/end.php" ) { // manejamos fallo
console.log( "Manejando fallo de pregunta..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers.shift(),
answered: false
}
}, () => chrome.runtime.sendMessage({redirect: "https://www.frikitrivial.com/game.php"}))
} else { // actualizamos el estado de la ultima pregunta respondida
if( !result.lastClicked.answered ){
console.log( "Manejando lastClicked not answered..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers,
answered: true
}
}, answerNewQuestion)
} else {
console.log( "Manejando lastClicked answered..." )
answerNewQuestion()
}
}
} else {
answerNewQuestion()
}
})
function answerNewQuestion() {
chrome.storage.sync.get([question], function(result){
if( result.question ) { // si ya hemos intentado responder esta pregunta alguna vez
if( result.question.answered ) {
chrome.storage.sync.set( {
[result.question]: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
} else {
chrome.storage.sync.set( {
lastClicked: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
}
} else {
chrome.storage.sync.set( {
[question]: {
question: question,
answers: answers,
answered: false
}
}, function( result ){
chrome.storage.sync.set( {
lastClicked: {
question: question,
answers: answers,
answered: false
}
}, () => click( answers[0] ) )
})
}
})
}
console.log( "Iniciando partida..." )
let question, answers, _answers
if( location.href !== "http://www.frikitrivial.com/end.php" ){
question = document.querySelectorAll("div.question")[0].textContent
answers =
_answers = document.querySelectorAll("a.answer")
document.querySelectorAll("a.answer").forEach( e => answers.push( e.textContent ) )
}
function click( s ) {
let c
for( let i = 0; i < 4; i++ ) {
if( s === _answers[i].textContent ) {
c = _answers[i]
}
}
console.log( "El siguiente elemento va a ser clickado..." )
console.log( c )
c.click()
}
chrome.storage.sync.get(["lastClicked"], function(result){
if( result.lastClicked ) {
console.log( "Leido lastClicked..." )
if( location.href === "http://www.frikitrivial.com/end.php" ) { // manejamos fallo
console.log( "Manejando fallo de pregunta..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers.shift(),
answered: false
}
}, () => chrome.runtime.sendMessage({redirect: "https://www.frikitrivial.com/game.php"}))
} else { // actualizamos el estado de la ultima pregunta respondida
if( !result.lastClicked.answered ){
console.log( "Manejando lastClicked not answered..." )
chrome.storage.sync.set({
[result.lastClicked.question]: {
question: result.lastClicked.question,
answers: result.lastClicked.answers,
answered: true
}
}, answerNewQuestion)
} else {
console.log( "Manejando lastClicked answered..." )
answerNewQuestion()
}
}
} else {
answerNewQuestion()
}
})
function answerNewQuestion() {
chrome.storage.sync.get([question], function(result){
if( result.question ) { // si ya hemos intentado responder esta pregunta alguna vez
if( result.question.answered ) {
chrome.storage.sync.set( {
[result.question]: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
} else {
chrome.storage.sync.set( {
lastClicked: {
question: result.question.question,
answers: result.question.answers,
answered: result.question.answered
}
}, () => click( result.question.answers[0] ) )
}
} else {
chrome.storage.sync.set( {
[question]: {
question: question,
answers: answers,
answered: false
}
}, function( result ){
chrome.storage.sync.set( {
lastClicked: {
question: question,
answers: answers,
answered: false
}
}, () => click( answers[0] ) )
})
}
})
}
javascript google-chrome google-chrome-extension google-chrome-devtools
javascript google-chrome google-chrome-extension google-chrome-devtools
edited Nov 19 '18 at 12:30
asked Nov 19 '18 at 12:04
Antonio Gamiz Delgado
304
304
I like to start debugging this sort of problem by commenting out almost the entire file except for the console.log statement and then running it, just to verify for certain that the problem has nothing to do with the content of the file itself.
– temporary_user_name
Nov 19 '18 at 12:08
1
You didn't show your manifest.json so I have to guess what happens on the third time. 1) Maybe the URL is different, which doesn't match"matches"
in manifest.json. 2) Maybe the page is using "soft" navigation via History API or by changing the hash (URL fragment)
– wOxxOm
Nov 19 '18 at 12:17
I'm going to add it wait!
– Antonio Gamiz Delgado
Nov 19 '18 at 12:28
add a comment |
I like to start debugging this sort of problem by commenting out almost the entire file except for the console.log statement and then running it, just to verify for certain that the problem has nothing to do with the content of the file itself.
– temporary_user_name
Nov 19 '18 at 12:08
1
You didn't show your manifest.json so I have to guess what happens on the third time. 1) Maybe the URL is different, which doesn't match"matches"
in manifest.json. 2) Maybe the page is using "soft" navigation via History API or by changing the hash (URL fragment)
– wOxxOm
Nov 19 '18 at 12:17
I'm going to add it wait!
– Antonio Gamiz Delgado
Nov 19 '18 at 12:28
I like to start debugging this sort of problem by commenting out almost the entire file except for the console.log statement and then running it, just to verify for certain that the problem has nothing to do with the content of the file itself.
– temporary_user_name
Nov 19 '18 at 12:08
I like to start debugging this sort of problem by commenting out almost the entire file except for the console.log statement and then running it, just to verify for certain that the problem has nothing to do with the content of the file itself.
– temporary_user_name
Nov 19 '18 at 12:08
1
1
You didn't show your manifest.json so I have to guess what happens on the third time. 1) Maybe the URL is different, which doesn't match
"matches"
in manifest.json. 2) Maybe the page is using "soft" navigation via History API or by changing the hash (URL fragment)– wOxxOm
Nov 19 '18 at 12:17
You didn't show your manifest.json so I have to guess what happens on the third time. 1) Maybe the URL is different, which doesn't match
"matches"
in manifest.json. 2) Maybe the page is using "soft" navigation via History API or by changing the hash (URL fragment)– wOxxOm
Nov 19 '18 at 12:17
I'm going to add it wait!
– Antonio Gamiz Delgado
Nov 19 '18 at 12:28
I'm going to add it wait!
– Antonio Gamiz Delgado
Nov 19 '18 at 12:28
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53374279%2fwhy-the-content-script-execution-does-not-continue-after-2-reloads%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53374279%2fwhy-the-content-script-execution-does-not-continue-after-2-reloads%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I like to start debugging this sort of problem by commenting out almost the entire file except for the console.log statement and then running it, just to verify for certain that the problem has nothing to do with the content of the file itself.
– temporary_user_name
Nov 19 '18 at 12:08
1
You didn't show your manifest.json so I have to guess what happens on the third time. 1) Maybe the URL is different, which doesn't match
"matches"
in manifest.json. 2) Maybe the page is using "soft" navigation via History API or by changing the hash (URL fragment)– wOxxOm
Nov 19 '18 at 12:17
I'm going to add it wait!
– Antonio Gamiz Delgado
Nov 19 '18 at 12:28