naver / egjs-agent

Extracts browser and operating system information from the user agent string or user agent object(userAgentData).
https://naver.github.io/egjs-agent/
MIT License
110 stars 18 forks source link

겔럭시 폴드 2 #46

Open sangheon-kim opened 3 years ago

sangheon-kim commented 3 years ago

삼성 브라우저에서는 모바일로 잘 뜨는데 크롬이나 카카오 인앱 브라우저에서 PC로 인식하네요..

daybrush commented 3 years ago

@sangheon-kim 아마도 Client Hints랑 관련된 이슈로 생각이 듭니다.

괜찮으시다면 비동기로 가져오는 방법으로 해보실래요?

import { getAccurateAgent } from "@egjs/agent";

// Use Promise
getAccurateAgent().then(agent => {
    // Check OS, OS version
    agent.os.name
    agent.os.version

    // Check Browser full verion
    agent.browser.version
});

// Use Callback
getAccurateAgent(agent => {});

안된다면 아래와 같은 방법으로 해보시길 바랍니다.


import getAgent from "@egjs/agent";

const agent = getAgent(navigator.userAgent);
sangheon-kim commented 3 years ago

@daybrush 혹시 여쭤보고 싶은건, 리드미 상에 제공해주신 데모 페이지의 경우에도 비동기방식이 아니라 동기방식으로 처리 되어있나요??

해당 데모 페이지에서도 삼성브라우저를 제외한 브라우저에서 isMobile이 false라고 나오는 상황이라서요.

그것이 확인되고 나서 제가 가이드 주신대로 변경하는 것이 순서에 맞을 것 같아서요 :)

daybrush commented 3 years ago

@sangheon-kim

네. 동기가 맞습니다.

최신 브라우저에서 isHints가 true가 되는 경우라면 동기로 가져오는 방식에서 부정확한 정보를 얻어올 수 있습니다.

sangheon-kim commented 3 years ago

@daybrush 좋은 답변 감사합니다 적용해보고, 다시 말씀 드리도록 하겠습니다 👍

sangheon-kim commented 3 years ago

@daybrush 방금 적용해서 테스트했는데... 비동기 형식으로 적용했는데도 현상 동일하네요...

daybrush commented 3 years ago

@sangheon-kim

https://naver.github.io/egjs-agent/ 데모에서 Your User Agent를 선택 후 이 부분이 어떻게 뜨는지 알 수 있을까요?

image

sangheon-kim commented 3 years ago

image

여기있습니다 :)

daybrush commented 3 years ago

@sangheon-kim 죄송하지만 하나 더 부탁드리고 싶은데요.

https://codepen.io/daybrush/pen/LYWrNod

여기서는 어떻게 나타나는지 알 수 있을까요?

sangheon-kim commented 3 years ago

image

저도 제폰이 아니라 팀원분 폰이어서..

sangheon-kim commented 3 years ago

삼성브라우저 ua는 저렇고 크롬과 카카오인앱브라우저가 위 이미지입니다

daybrush commented 3 years ago

크롬과 카카오인앱브라우저에서 codepen 내용 알 수 있을까요?

sangheon-kim commented 3 years ago

@daybrush 제가 계속 바빴어서 이제야 회신드리네요 그분이 출근하실때 확인되면 올려드리겠습니다.

daybrush commented 3 years ago

@sangheon-kim

안녕하세요. 갤럭시 폴드2 크롬에서 테스트 해봤지만 문제 없이 동작을 하는 것 같습니다.

IMG_7361

카카오톡에서 테스트할 수가 없어 @sangheon-kim 님의 스샷을 봐야 할 것 같습니다.

만약 isMobile이 true면 비동기 사용 방법이 동일하기에 다시 한 번 소스 코드를 확인해 보시길 바랍니다.

sangheon-kim commented 3 years ago

오히려 제가 확인한거로는 크롬 브라우저에서 isMobile이 false가 나오네여

image

image

daybrush commented 3 years ago

@sangheon-kim

크롬 PC 데스크탑 모드가 실행된 것 같습니다.

sangheon-kim commented 3 years ago

@daybrush 혹시 해당코드대로 했는데.. 흠 현재 코드 펜쪽 코드 한번 확인 가능할까요?

daybrush commented 3 years ago

@sangheon-kim

이거 말하시는 걸까요?

eg.agent.getAccurateAgent().then(agentInfo => {

  document.querySelector("div").innerHTML = `${navigator.userAgent}<br/><br/><br/>${JSON.stringify(agentInfo)}`;
});
sangheon-kim commented 3 years ago

아하 저도 동일코드로했는데 왜 증상이 다른지 저도 한번 봐볼게요

stale[bot] commented 2 years ago

This issue/PR has been automatically marked as stale because it has not had any update (including commits, comments, labels, milestones, etc) for 30 days. It will be closed automatically if no further update occurs in 7 day. Thank you for your contributions!

한글 이 이슈/PR은 commits, comments, labels, milestones 등 30일간 활동이 없어 자동으로 stale 상태로 전환되었습니다. 이후 7일간 활동이 없다면 자동으로 닫힐 예정입니다. 프로젝트 개선에 기여해주셔서 감사합니다.

qkreltms commented 2 years ago

Any updates on this? @sangheon-kim

stale[bot] commented 2 years ago

This issue/PR has been automatically marked as stale because it has not had any update (including commits, comments, labels, milestones, etc) for 30 days. It will be closed automatically if no further update occurs in 7 day. Thank you for your contributions!

한글 이 이슈/PR은 commits, comments, labels, milestones 등 30일간 활동이 없어 자동으로 stale 상태로 전환되었습니다. 이후 7일간 활동이 없다면 자동으로 닫힐 예정입니다. 프로젝트 개선에 기여해주셔서 감사합니다.