How To Insert Html/js Into Window (of Type "panel") Created By Chrome.windows.create?
Solution 1:
I discovered the answer, after more reading and experimenting: When creating the window, you need to create a tab and attach it to the window. So, your create createData
object will contain a URL attribute which simply points to the HTML page (with CSS, JS, whatever you want) sitting in (by default) the root folder of the extension (so if you want your HTML files kept elsewhere, simply prefix the filename with a path). Now, when the window is created, it's created with one tab (which, from the UI perspective doesn't even show as a tab - which is nice) and that tab contains the content you want.
Solution 2:
Try this I have not tested it myself but might give you some idea....
(function(){ chrome.windows.create({ type: 'panel', url: "https://www.google.co.in/" }, function (newWindow) { console.log(newWindow); chrome.tabs.executeScript(newWindow.tabs[0].id, { code: 'document.write("hello world");' }); }); })()
and also as mention in this Chromium Projects link about panels you can manipulate pane same as other windows types.
Post a Comment for "How To Insert Html/js Into Window (of Type "panel") Created By Chrome.windows.create?"