Reputation: 3069
How can I control a new tab opened with chrome.browser.openTab({url:""}, function () { });
?
Control in the sense, things we do with JavaScript like change the URL of the tab, get element by ID and change element attributes, etc.
Is it possible within a Chrome app or do I have to create a Chrome app plus an extension and control everything using message passing?
Upvotes: 0
Views: 877
Reputation: 2455
If it has to be a Chrome App controlling contents of a Chrome browser tab, then I think what you suggest at the end is the best option: Chrome app communicates with Chrome extension via message passing and Chrome extension modifies the page.
https://developer.chrome.com/extensions/messaging#external
Probably this does not fit your use case, but if the website could be displayed from the Chrome app, you could use a <webview>
tag, the website would not be sandboxed, and you could control its contents using webview.executeScript
and the contentload
event
https://developer.chrome.com/apps/tags/webview#example https://developer.chrome.com/apps/tags/webview#event-contentload
Upvotes: 1