Browser support
Check whether this browser can provide a WebGPU device.
Use HTTPS
WebGPU and Web Crypto require a secure browser context. Open the HTTPS site before running the examples. Browser, operating system, driver, and device support all affect whether an adapter is available.
Request an adapter
Checking navigator.gpu is only the first step. The browser may expose the API but return no adapter. This example requests a device and releases it immediately, without starting a mining job.
if (!window.isSecureContext || !navigator.gpu) {
console.log('WebGPU unavailable. Use CPU mode.');
} else {
let device;
try {
const adapter = await navigator.gpu.requestAdapter();
if (!adapter) {
console.log('No WebGPU adapter. Use CPU mode.');
} else {
device = await adapter.requestDevice();
console.log('WebGPU device available.');
}
} catch {
console.log('WebGPU device unavailable. Use CPU mode.');
} finally {
device?.destroy();
}
}CPU mode
If the check fails, choose CPU on the desk. A successful check confirms device access now; it does not guarantee a hashrate or that the device will remain available after sleep.
Keep the tab active
Backgrounding the browser, sleeping the device, and power-saving settings can interrupt work. After waking the device, read the desk status before restarting.