简体   繁体   English

如何从chrome扩展程序中打开标签页,等待用户输入并返回扩展程序?

[英]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.

相关问题 chrome-extension:等待用户输入 - chrome-extension: wait for input from user 如何在Chrome扩展程序的新标签页中打开URL? - How do I open a URL in a new tab from within a chrome extension? 如何在下方的同一标签中打开Goog​​le Chrome扩展程序弹出窗口中的链接? - How do I have a link from a Google Chrome extension popup open in the same tab underneath? 如何创建可以从弹出窗口打开新选项卡的 ReactJS chrome 扩展? - How do I create a ReactJS chrome extension that can open a new tab from a popup? Chrome Javascript扩展程序 - 如何在新标签页中打开页面,而无需实际转到该标签页? - Chrome Javascript Extension - How do I open a page in a new tab w/o actually going to that tab? 我怎样才能打开带有 chrome 扩展的新标签页? - How can i open the new tab with chrome extension? 如何创建chrome扩展名以打开由用户输入生成的特定网址? - how to create chrome extension to open specific url that generated by user input? Chrome 扩展程序:如何在新标签页中打开链接? - Chrome extension: How to open a link in new tab? Chrome扩展程序:打开标签页,转到网址,填写表单并提交表单 - Chrome Extension: Open tab, go to url, fill form and submit form Chrome 扩展程序中的更新选项卡并等到它打开以打开另一个下载链接。 如何等到 url 在选项卡中打开? - Update Tab in Chrome Extension And Wait Till It opened to open another download link. How to wait till url is opened in the tab?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM