Skip to content Skip to sidebar Skip to footer

Chrome Inject Script Inconsistency Issue

Below function I did was to redirect user to a login page, and then inject a js to login the user. The code below worked well but not consistent, I hardly can debug it because the

Solution 1:

By default scripts are injected at document_idle which doesn't work consistently with jQuery, probably because it's big or uses some asynchronous initialization.

Answer : explicitly specify that the injected scripts should run immediately.

chrome.tabs.executeScript({file: "jquery.js", runAt: "document_start"}, function(result) {
});

Post a Comment for "Chrome Inject Script Inconsistency Issue"