[英]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. 我正在开发chrome扩展程序,并且有一个脚本可以打开新标签供用户执行操作。 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? 我使用chrome.tabs.create打开新标签页,但是我猜回调函数无法按照我想要的方式工作,对吗?
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. 一旦确定登录已经完成(通过页面的URL或某些DOM元素),就可以将消息从内容脚本发送回扩展的后台进程(使用sendRequest ),并使其执行任何进一步的必要操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.