Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 保存用户数据google chrome扩展_Javascript_Html_Google Chrome Extension - Fatal编程技术网

Javascript 保存用户数据google chrome扩展

Javascript 保存用户数据google chrome扩展,javascript,html,google-chrome-extension,Javascript,Html,Google Chrome Extension,我正在尝试创建我的第一个Google Chrome扩展。下面解释了我想要扩展什么,然后我的问题是什么 我想创建一个与Linkedin一起运行的扩展。用户可以在扩展中输入参数(使用html),然后将此输入和用户过去的所有输入保存到列表中。然后,这可能会与linkedin连接(如果它们有扩展名)进行比较,具有相同输入的连接将显示在扩展名中 我现在想做的是让用户的列表显示在扩展中。我研究过存储,主要是“chrome.storage.sync.set”,但我不确定它是否适用于我的情况(因为我才刚刚开始,

我正在尝试创建我的第一个Google Chrome扩展。下面解释了我想要扩展什么,然后我的问题是什么

我想创建一个与Linkedin一起运行的扩展。用户可以在扩展中输入参数(使用html),然后将此输入和用户过去的所有输入保存到列表中。然后,这可能会与linkedin连接(如果它们有扩展名)进行比较,具有相同输入的连接将显示在扩展名中

我现在想做的是让用户的列表显示在扩展中。我研究过存储,主要是“chrome.storage.sync.set”,但我不确定它是否适用于我的情况(因为我才刚刚开始,我了解得很少)。我猜他可能必须登录,这样每个用户都会有一个列表

my popup.html如下所示:

<!DOCTYPE html>
<html>
  <head>
    <style>
      button {
        height: 30px;
        width: 30px;
        outline: none;
      }
    </style>
  </head>
  <body>
    Job: <input type="text" name="Job" value="FB"><br>
    <input type="submit" value="Submit">
    <script src="popup.js"></script>
  </body>
</html>

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

'use strict';


chrome.runtime.onInstalled.addListener(function() {
  chrome.storage.sync.set({color: '#3aa757'}, function() {
    console.log('The color is green.');
  });
  chrome.storage.sync.set({ "yourBody": "myBody" }, function() {
    console.log('Body has been saved');
  });
  chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
    chrome.declarativeContent.onPageChanged.addRules([{
      conditions: [new chrome.declarativeContent.PageStateMatcher({
        pageUrl: { urlContains: 'linkedin' },
      })
      ],
          actions: [new chrome.declarativeContent.ShowPageAction()]
    }]);
  });
});
也许我正试图做的是不可能的(userMe可以将在extension中输入的数据与他/她的连接中的任何用户进行比较),在这种情况下,如果有人能告诉我是否不可能,我会很高兴


Cheeers

不清楚你想要实现什么,以及是什么阻止了你这样做。什么是“具有相同输入的连接”?问题中似乎有很多不必要的信息,例如,发布的代码很好,但它没有做任何有用或相关的事情。如果你需要一个例子,这里有一些:我同意,除了你想要一个扩展来比较“在扩展中输入的数据与他/她的连接中的任何用户”之外,很难理解。您需要在页面顶部添加一个chrome.storage.sync.get。除非你把它放在另一个文件中,并从HTML加载它。。。。