Skip to content

Instantly share code, notes, and snippets.

@hmmhmmhm
Forked from vzts/avoid-in-app.js
Created August 19, 2024 05:38
Show Gist options
  • Save hmmhmmhm/0e701fc9d691f7a7f816991279f9cdc3 to your computer and use it in GitHub Desktop.
Save hmmhmmhm/0e701fc9d691f7a7f816991279f9cdc3 to your computer and use it in GitHub Desktop.
카카오톡 인앱 브라우저 탈출하기 코드 가장 심플하게 정리 (2023.10.27 동작 확인)
const userAgent = navigator.userAgent.toLowerCase()
if (/kakaotalk/.test(userAgent)) {
location.href =
'kakaotalk://web/openExternal?url=' + encodeURIComponent(location.href)
setTimeout(() => {
location.href = /ipad|iphone|ipod/.test(userAgent)
? 'kakaoweb://closeBrowser'
: 'kakaotalk://inappbrowser/close'
})
}
@hmmhmmhm
Copy link
Author

여는 URL을 https:// 가 아닌 googlechrome:// 으로 열면 카카오톡 인앱 브라우저에서 크롬 브라우저로 탈출도 가능함을 확인하였습니다.

@StatPan
Copy link

StatPan commented Sep 5, 2024

탈출이 가능함을 확인함을 확인하였습니다

@hmmhmmhm
Copy link
Author

hmmhmmhm commented Sep 5, 2024

탈출이 가능함을 확인함을 확인하였습니다

더블 체크 감삼니다

@boxqkrtm
Copy link

boxqkrtm commented Sep 5, 2024

좋네요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment