eiab

Escape In-App Browser — Detect and escape from in-app browsers (Facebook, Instagram, Threads, Messenger, Twitter/X, TikTok, WhatsApp, WeChat, LINE, Snapchat, LinkedIn, Google Search App, KakaoTalk)

Zero DependenciesESM Only< 1KB
Try It Yourself
Share this page and open it from Instagram, Facebook, or Twitter to see eiab in action
Your browser:Checking...

Open the shared link from Instagram, Facebook, Twitter, or any other app to test detection

Code
<EiabSuccess>
  <p>You're in a normal browser!</p>
</EiabSuccess>
<EiabFailed>
  <p>Please open in Safari or Chrome.</p>
</EiabFailed>
Live Result

Loading...

Core API Demo
Test in-app browser detection with different user agents
Simulated User Agent
Mozilla/5.0 (iPhone; CPU iPhone OS 18_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1 Mobile/15E148 Safari/604.1
isInAppBrowser()Normal Browser
getEscapeUrl()
null (no escape needed)
React Components
Conditional rendering with EiabSuccess and EiabFailed
useIsInAppBrowser():null (SSR)
Loading...

Code Example:

<EiabSuccess>
  <p>You're in a normal browser!</p>
</EiabSuccess>
<EiabFailed>
  <p>Please open in Safari or Chrome.</p>
</EiabFailed>
Escape UI Components
User-gesture-based escape for apps that block automatic redirects (Instagram, Facebook)
EiabEscapeLink
<EiabEscapeLink>
  Open in Safari
</EiabEscapeLink>
EiabEscapeDialog
<EscapeInAppBrowser
  fallback={<EiabEscapeDialog />}
/>
Meta iOS apps (Instagram v417+, Facebook) block automatic x-safari-https:// redirects. These components use window.open() from a user tap, which still works.
Escape Strategies
Platform-specific methods to escape in-app browsers
iOS (Generic)
x-safari-https://...

Opens directly in Safari

Android (Generic)
intent://...#Intent;scheme=https;S.browser_fallback_url=...;end

Intent URI opens user's default browser with fallback

KakaoTalk
kakaotalk://web/openExternal?url=...

Uses KakaoTalk's native external browser scheme

LINE (iOS/Android)
?openExternalBrowser=1

LINE respects this query parameter on both platforms

Quick Start
Add eiab to your app in seconds
Install
bun add eiab
Vanilla JS
import { attemptEscape } from "eiab"

// Auto-escapes if in-app browser detected
attemptEscape()
React / Next.js
import {
  EscapeInAppBrowser,
  EiabEscapeDialog,
} from "eiab/react"

export default function Layout({ children }) {
  return (
    <>
      <EscapeInAppBrowser
        fallback={<EiabEscapeDialog />}
      />
      {children}
    </>
  )
}