小编Mic*_*ter的帖子

chrome.runtime.onInstalled未定义

我要在安装扩展程序后启动这些选项。这是我在这种情况下尝试使用的许多解决方案。

我的问题chrome.runtime.onInstalled是未定义。这是我的源代码:

background.js

if(typeof chrome.runtime.onInstalled  !== 'undefined')
{
    chrome.runtime.onInstalled.addListener(function (details)
    {
        //if(details.reason == 'update') window.open(chrome.extension.getURL('options.html'));
        if(details.reason == 'install') window.open(chrome.extension.getURL('options.html'));
    });
}
Run Code Online (Sandbox Code Playgroud)

我的manifest.json

{
  "name": "Context Menu 2.0 for Google Translate™",
  "short_name": "Translate",
  "version": "1.0.0.4",
  "manifest_version": 2,
  "description": "Creates a context menu option to translate selected texts to a specified language",
  "icons": {
    "16": "trans_16.png",
    "64": "trans_64.png",
    "128": "trans_128.png"
  },
  "content_scripts": [
    {
      "matches":
      [
          "http://*/*", "https://*/*"
      ],
      "js": ["background.js"]
    }
  ], 
  "options_page": "options.html",
  "background": {
    "scripts": ["background.js"]
  }, …
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome google-chrome-extension

3
推荐指数
1
解决办法
1136
查看次数

PHP:测量 TTFB(第一个字节的时间)

由于 TTFB 可能因每个请求而异,因此我想对其进行统计并获得平均值。有谁知道我如何通过 PHP 来衡量这个?网站 bytecheck.com 能够分析这些数据:以下是 example.com 的示例:http ://www.bytecheck.com/results?resource=example.com

有没有人建议我如何实现这样的目标?

提前致谢。

php performance measurement

3
推荐指数
1
解决办法
2119
查看次数