Take the 2-minute tour ×

I am writing a chrome extension to allow users to login to social media sites from a single page. I am able to create a new incognito window but am unable to manipulate anything inside of the window that I created. I want to create an onload function for the new window to execute jquery. Thanks for getting me pointed in the right direction!

share|improve this question
have you tried script injection with call back of tab create/update()? –  Sudarshan Dec 26 '12 at 18:10
I have not but I'm not sure where to start with that. Any good resources you can point me to? –  Chris Jenkins Dec 26 '12 at 18:12
If you want to manipulate incognito, you have to ask the user to check "Allow in incognito" under your extension in the settings –  gengkev Dec 26 '12 at 19:54
@ChrisJenkins: Check my answer and let me know if you questions. –  Sudarshan Dec 27 '12 at 5:41
add comment

1 Answer

up vote 5 down vote accepted

Refer the following demonstration for manipulation of new incognito window created and injecting some jquery into it.


manifest file

This is used to bind permissions and register background pages to extension.Ensure it has all permissions needed.

"name":"Hanlder for Incognito window",


Inject jquery into new incognito window, from background page.

var _tabId_To_Look_For;

// Create a new incognito Window with some arbitary URL and give it focus
    "url": "http://www.google.co.in/",
    "focused": true,
    "incognito": true
}, function (window) {
    // Trace tab id which is created with this query 
    _tabId_To_Look_For = window.tabs[0].id

// Add an event Listener for new tab created
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
    // Inject script into chosen tab after it is loaded completely
    if (tabId == _tabId_To_Look_For && changeInfo.status == "complete") {
        // Inject Jquery and in current tab
        chrome.tabs.executeScript(tabId, {
            "file": "jquery.js"
        }, function () {
            // I am in call back
            console.log("Injected some jquery ");

Ensure you have enabled incognito access.

enter image description here


You will observe a new window with jquery injected.

share|improve this answer
And today I just learned how to inject scripts to tabs using that file option, thanks! –  jjperezaguinaga Dec 27 '12 at 16:43
That is awesome! Thanks! –  Chris Jenkins Dec 27 '12 at 20:27
add comment

Your Answer


