Skip to content

Commit d11eb65

Browse files
committed
Workaround for devpanel not having access in incognito mode
Related to #597 and 580
1 parent de2c792 commit d11eb65

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed
+14-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1-
chrome.devtools.panels.create(
2-
'Redux', 'img/logo/scalable.png', chrome.extension.getBackgroundPage ? 'window.html' : 'devpanel.html', function() {}
3-
);
1+
function createPanel(url) {
2+
chrome.devtools.panels.create(
3+
'Redux', 'img/logo/scalable.png', url, function() {}
4+
);
5+
}
6+
7+
if (chrome.runtime.getBackgroundPage) {
8+
// Check if the background page's object is accessible (not in incognito)
9+
chrome.runtime.getBackgroundPage(background => {
10+
createPanel(background ? 'window.html' : 'devpanel.html');
11+
});
12+
} else {
13+
createPanel('devpanel.html');
14+
}

0 commit comments

Comments
 (0)