feat: implement openExternalUrl utility for consistent external link handling
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
/**
|
||||
* Open an external URL using Tauri shell on desktop/mobile, or window.open in browser
|
||||
* @param url The URL to open
|
||||
*/
|
||||
export const openExternalUrl = async (url: string): Promise<void> => {
|
||||
if (isTauri()) {
|
||||
try {
|
||||
const { open } = await import('@tauri-apps/plugin-shell');
|
||||
await open(url);
|
||||
return;
|
||||
} catch (err) {
|
||||
console.warn('Tauri shell.open failed, falling back to window.open:', err);
|
||||
}
|
||||
}
|
||||
window.open(url, '_blank');
|
||||
};
|
||||
/**
|
||||
* Tauri-specific utilities for desktop and mobile platforms
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user