我想编写一个脚本(从chrome的二进制文件运行),lighthouse
并提供给定的url。我没有设法找到方法,但是由于甚至还有一个chrome扩展程序,我认为它应该可行吧?
我有一个使用 SSL 托管在 AWS(使用 CloudFront 的 S3)上的网站。当我通过 Chrome 执行 Lighthouse 测试时,该测试在除主页之外的任何页面上都不起作用。它针对除性能以外的所有测试返回问号,并返回以下错误:
存在影响 Lighthouse 运行的问题:Lighthouse 无法可靠地加载您请求的页面。确保您正在测试正确的 URL 并且服务器正确响应所有请求。状态码:404。”
这是一个 ReactJS SPA 网站,Lighthouse 确实通过调试工作,但是当我尝试 URL 中的 S3 或 cloudfront 域或我购买的实际域时,它不起作用。它是否曾经工作过我不是 100% 确定,因为我可能只在主页上尝试过它并假设它适用于所有页面。
任何人都可以建议我可以尝试的任何明显的东西(解决或给我更多分析)?我对 AWS 和 React 还很陌生。除此之外,该网站似乎运行良好。
非常感谢 :)
我有一个网站,主页横幅上有一个视频,当用户进入该页面时,该视频会自动播放。Google PageSpeed Insights 因此抱怨视频网络负载。我想知道如何才能避免收到此消息。我正在查看这个网站:https://www.leclosdamboise.com/ 他们也有一个视频播放(40mo),但在 Google PageSpeed Insights 上没有收到“网络过载”错误消息。任何人都知道他们是如何做到的?谢谢
我将如何在objective-c中复制这个
curl -u rick@email.com:mypassword http://foo.lighthouseapp.com/projects.xml
Run Code Online (Sandbox Code Playgroud)
我一直在玩ASIHTTPRequest库,但似乎无法搞清楚,
显然发送我的请求会返回一个身份验证错误:
-(void)submit:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://ldn.lighthouseapp.com/projects/63254-londonist-20/tickets.xml"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request startSynchronous];
NSError *error = [request error];
if (!error) {
NSString *response = [request responseString];
NSLog(@"response:%@",response);
} else {
NSLog(@"error:%@",error);
}
}
Run Code Online (Sandbox Code Playgroud)
这可能很简单,我只是缺少一些非常重要的东西
任何人都可以帮我设置无头镀铬的代理服务器,同时在这里提到Node.js中的灯塔镀铬启动器
const launcher = new ChromeLauncher({
port: 9222,
autoSelectChrome: true, // False to manually select which Chrome install.
additionalFlags: [
'--window-size=412,732',
'--disable-gpu',
'--proxy-server="IP:PORT"',
headless ? '--headless' : ''
]
});
Run Code Online (Sandbox Code Playgroud)
但是,上面的脚本根本没有命中我的代理服务器.Chrome似乎回退到DIRECT://与目标网站的连接.
关于在无头chrome的上下文中使用HTTP/HTTPS代理服务器的另一个资源就是这个.但它没有给出如何从Node.js使用它的任何示例.
google-chrome node.js headless-browser lighthouse google-chrome-devtools
I am running the Google Page Speed test for https://www.oceanluxe.com.au and get the following message:
> Lighthouse returned error: NO_FCP. Something went wrong with the recording
> the trace over your page load. Please run the Lighthouse again. (NO_FCP)
> (NO_FCP)
Run Code Online (Sandbox Code Playgroud)
Can anyone help?
Tried on different servers, tried various URLs as well http://oceanluxe.com.au
我正在尝试提高我在Google灯塔上的效果得分。建议使用下一代图像格式,包括webp,因此我使用Nginx config来实现服务webp代替图像,其中请求接受标头包括webp。
map $http_accept $webp_suffix {
default "";
"~*webp" ".webp";
}
server {
root /www/;
listen 80 default_server;
index index.html;
location ~* ^\/images\/ {
expires max;
add_header Vary Accept;
try_files $uri$webp_suffix $uri =404;
}
location / {
try_files $uri $uri/index.html =404;
}
error_page 404 /404.html;
}
Run Code Online (Sandbox Code Playgroud)
现在页面加载速度大大提高,并且webp方法运行良好,可以回退到不存在webp或浏览器不支持的原始图像。但是,灯塔报告显示了一个错误,因此无法确定我是否正确实施了所有内容。这个错误是什么意思?
我正在尝试在 Chrome Lighthouse 上审核我的应用程序,但我无法让 Service Worker 工作。它已注册并运行,没有错误,但是当我尝试运行 Lighthouse 时,它被卡住并控制台记录以下错误:
Service worker not registered DOMException: Failed to register a ServiceWorker for scope ('https://www.localhost.com/') with script ('https://www.localhost.com/sw.js'): Operation has been aborted
Run Code Online (Sandbox Code Playgroud)
SW 的调用方式为:
if('serviceWorker' in navigator){
let sw = 'sw.js';
navigator.serviceWorker.register(sw, {scope: "/"})
.then(function(){
console.log('Service worker registered.');
})
.catch(function(e){
console.log('Service worker not registered ', e);
})
}
Run Code Online (Sandbox Code Playgroud)
在清单中:
start_url: "/",
scope: "/",
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
“../”、“https://www.localhost.com/”、“./”、
我正在使用以下标志运行 chrome:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=https://www.localhost.com
Run Code Online (Sandbox Code Playgroud)
但是,我还尝试使用 https 在远程服务器中运行该应用程序,但出现了相同的错误。
你能帮忙的话,我会很高兴。
图像运行得很好。这是代码
<Image
layout="fixed"
src="/images/example.jpeg"
alt="Example image"
width="140"
height="140"
/>
Run Code Online (Sandbox Code Playgroud)
但是,当我在 web.dev 上运行该网站时,我在性能方面没有获得最高分。主要原因是图像元素没有明确的宽度和高度
我已经研究过这个,并且可以从这里看出https://web.dev/optimize-cls/?utm_source=lighthouse&utm_medium=lr#images-without-dimensions 需要宽度和高度属性,但不会出现,使用下一张/图片
我该如何解决这个问题?
lighthouse ×10
next.js ×1
nextjs-image ×1
nginx ×1
node.js ×1
objective-c ×1
pagespeed ×1
payload ×1
video ×1
webp ×1