简体   繁体   中英

how do I, from chrome extension, open tab wait for user input and go back to extension?

I'm working on a chrome extension and I have a script that opens a new tab for the user to do something. How can I can get a response from it, but only after the user clicks a button on that new tab, for instance?

Any ideas?

I use chrome.tabs.create to open a new tab, but I guess the callback wont work the way I want it to, right?

You can create a content script that'll work only on the desired webpage (where your users log in). Once you identify the login has been completed (by the page's URL, or by some DOM elements), you can send a message back from the content script to the extension's background process (using sendRequest ), and have it do any further necessary action.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM