generated from 2-NOW/react-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
디자인 요청 사항 메인 브랜치 반영
- Loading branch information
Showing
7 changed files
with
50 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
import Cookies from "js-cookie"; | ||
|
||
export function UseExternalBrowser() { | ||
const agent = navigator.userAgent; | ||
const URL = document.URL; | ||
let isExternalBrowser = false; | ||
|
||
// NOTE: 카카오톡 인앱 브라우저 방지 | ||
if (agent.indexOf("KAKAO") !== -1) { | ||
const URL = document.URL; | ||
window.open(`kakaotalk://web/openExternal?url=${encodeURIComponent(URL)}`); | ||
} else if (agent.indexOf("Instagram") !== -1) { | ||
// NOTE: 현재는 해당 인스타그램 인앱 탈출 코드가 작동하지 않는 것 같음 | ||
window.open(`https://www.praise-up.app`, "_system"); | ||
} else { | ||
isExternalBrowser = true; | ||
} | ||
// TODO: 라인, 인스타그램 추후 대응 | ||
|
||
if (!isExternalBrowser) { | ||
Cookies.set("isEnternalBrowser", "false"); | ||
} else { | ||
if (Cookies.get("isEnternalBrowser")) { | ||
Cookies.remove("isEnternalBrowser"); | ||
} | ||
} | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters