tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[docs] Canonical way to check if a page is running in Tauri

Open venkr opened this issue 1 year ago • 1 comments

It'd be great if there was a documented way to check if a page is running in Tauri.

When withGlobalTauri is on, or in 1.0, you could test window.__TAURI__ != undefined However, this doesn't always hold - in 2.0 with withGlobalTauri off.

There are recommendations to use __TAURI_METADATA__ (https://github.com/tauri-apps/tauri/discussions/2725#discussioncomment-4018369) - but that doesn't seem to always hold in 2.0

I'd love to see a documented canonical isTauri function.

venkr avatar Feb 20 '24 18:02 venkr