File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ "use client" ;
2+
3+ import { useEffect } from "react" ;
4+
5+ export default function BrowserCheck ( ) {
6+ useEffect ( ( ) => {
7+ async function detectHeadless ( ) {
8+ try {
9+ const isWebdriver = navigator . webdriver ;
10+ const hardwareConcurrency = navigator . hardwareConcurrency || 0 ;
11+
12+ if ( isWebdriver || hardwareConcurrency < 2 ) {
13+ document . title = "Access Denied" ;
14+ document . body . innerHTML =
15+ "<h1 style='text-align:center;margin-top:20vh;font-family:sans-serif;'>Access Denied</h1>" ;
16+ window . stop ( ) ;
17+ }
18+ } catch ( err ) {
19+ console . error ( "Browser check error:" , err ) ;
20+ }
21+ }
22+
23+ detectHeadless ( ) ;
24+ } , [ ] ) ;
25+
26+ return null ;
27+ }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import DevToolsDetector from "./components/DevToolsDetector";
77import NextTopLoader from "nextjs-toploader" ;
88import { headers } from "next/headers" ;
99import NortonSafeweb from "./components/NortonSafeweb" ;
10+ import BrowserCheck from "./components/BrowserCheck" ;
1011
1112const geistSans = Geist ( {
1213 variable : "--font-geist-sans" ,
@@ -120,6 +121,7 @@ export default function RootLayout({
120121 { isProduction && (
121122 < >
122123 < DevToolsDetector />
124+ < BrowserCheck />
123125 </ >
124126 ) }
125127 </ body >
You can’t perform that action at this time.
0 commit comments