Chrome: open a custom input interface on click
Is it possible to register the selection (may it be via a click or other ways) of a text field (of any kind) wi开发者_如何学编程th my extension and open up a separate input interface?
You can use a prompt...
<script>
function disp_prompt() {
var fname=prompt("What is your name?");
alert("Your name is " + fname);
}
</script>
<body onload=disp_prompt()>
If you want to have this popup onclick, You need to utilize a background page
chrome.browserAction.onClicked.addListener(function(tab){
http://code.google.com/chrome/extensions/browserAction.html#event-onClicked
Yes. You can capture the user interaction with JavaScript in a content script. And if by “separate input interface”, you’re referring to something within the browser, you can also inject UI or open a new page with a content script. If you’re referring to another app, you can launch one with native code in an NPAPI plugin.
精彩评论