简体   繁体   English

如何判断网站是否使用 next.js?

[英]How to tell if a website is using next.js?

It's easy to tell if a website uses ReactJS, by using the React Developer Tools .通过使用React Developer Tools可以很容易地判断网站是否使用 ReactJS。

However, I know a website that uses ReactJS and Server Side Rendering (the whole page is built with React components, but the page source contains the whole HTML).但是,我知道一个使用 ReactJS 和服务器端渲染的网站(整个页面都是用 React 组件构建的,但页面源包含整个 HTML)。 Is it possible to tell if this website uses Next.js in particular for SSR?是否可以判断该网站是否使用Next.js特别用于SSR?

Does Next.js leave any trace detectable on the front-end? Next.js 是否在前端留下任何可检测到的痕迹?

By default, Next.js sets the X-Powered-By header to Next.js .默认情况下,Next.js 将X-Powered-By header 设置为Next.js So if you check Chrome's devtools for a page, you can check to see if this header exists.因此,如果您检查 Chrome 的 devtools 页面,您可以检查此 header 是否存在。

Note : Developers can opt-out of including this header .注意开发人员可以选择不包含此 header So if the header does not exist, it is not evidence that the website does not use Next.js所以如果header不存在,则不能证明该网站没有使用Next.js

在此处输入图像描述

If you are seeing content is wrapped with id="__next", this website use next.js如果您看到内容用 id="__next" 包装,本网站使用 next.js

like uber像超级

在此处输入图像描述

and like netflix和Netflix一样

在此处输入图像描述

Version of Next.js + properties of the page:版本Next.js+页面属性:

console.log({
  NextJSVersion: window.next?.version,
  pageProps: window.__NEXT_DATA__?.props?.pageProps
})

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

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