繁体   English   中英

Chrome扩展程序HTML表单

[英]Chrome-Extension HTML form

我正在创建此Chrome扩展程序,当您单击当前页面上的按钮时,它将启动一个新的HTML页面,其中包含用户必须完成的某些输入字段。 该按钮在content.js内部被触发。 我想知道将用户在HTML表单中输入的信息检索回内容脚本的最佳/最简便的方法/或在表单中的“提交”按钮被按下后重写localStorage变量以在内容脚本中可用的方法是什么?按下。 任何想法将不胜感激!

因为您没有代码,所以这纯粹是猜测。 即使这样,我认为chrome.storage.local还是有用的。

这是来自Google网站的示例:

  function saveChanges() {
    // You'd get a value from your form here.
    var theValue = textarea.value;
    // CCheck there's actually something there
    if (!theValue) {
      message('ERROR - There's nothing here');
      return;
    }
    // Now use the Chrome Storage API to save the settings
    chrome.storage.sync.set({'value': theValue}, function() {
      // Success! Let's log a message.
      message('Settings saved');
    });
  }

如果您需要更多帮助, 请查看信息页面

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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