diff --git a/js/web/script/test-runner-cli.ts b/js/web/script/test-runner-cli.ts index 03d637b35bc7c..b67e173a22793 100644 --- a/js/web/script/test-runner-cli.ts +++ b/js/web/script/test-runner-cli.ts @@ -558,7 +558,9 @@ async function main() { if (args.noSandbox) { karmaArgs.push('--no-sandbox'); } - if (webgpu || webnn) { + + // When using BrowserStack with Safari, we need NOT to use 'localhost' as the hostname. + if (!(browser.startsWith('BS_') && browser.includes('Safari'))) { karmaArgs.push('--force-localhost'); } if (webgpu) {