Content
@
https://warpcast.com/~/channel/frames
0 reply
4 recasts
4 reactions
NelsonRodMar.eth
@nelsonrodmar
I'm actually adapting a website to be FramesV2 aka MiniApps compatible. The project use this library https://github.com/duskload/react-device-detect to know if the website is open on a computer or a mobile and so adapt its design depending on what the answer is. To detect if it's a mobile or a computer, this library is based on the User-Agent header. So my question is what User-Agent is send in MiniApps ? Because it looks like it’s a User-Agent from a computer, and my website is visible like if it was on a computer. And could it be possible for the Farcaster team to change the User-Agent headers ? Taging some Farcaster dev ecosystem to get some visibility @linda @woj.eth @ted and also @samuellhuber.eth maybe you got and idea
1 reply
2 recasts
11 reactions
Samuel ツ
@samuellhuber.eth
you'd check frame sdk context being available or not to see if you're in a Farcaster Frame or not. const [context, setContext] = useState<FrameContext>(); useEffect(() => { const load = async () => { setContext(await sdk.context); sdk.actions.ready(); }; if (sdk && !isSDKLoaded) { setIsSDKLoaded(true); load(); } }, [isSDKLoaded]); then in your code check if context?.user exists or not.
1 reply
0 recast
2 reactions
NelsonRodMar.eth
@nelsonrodmar
Actually it's my solution to try detect if I'm in a Frame and so force to be in Mobile. But it ask a looooooot of refactoring because I need to push a second variable everywhere the isMobile is used to transform it to (isMobile || isFrame) and the isMobile is used everywhere, even in styles pages So wanted to know if it was possible to change the User-Agent header in a MiniApps so it would be detected as mobile, thing that would be logical since that even a MiniApps open on computer as the size of a mobile But yeah I'm actually doing this otherwise actually trying to refactor everywhere
1 reply
0 recast
0 reaction
flick the dev 🎩📦
@flick
your html is proxied so user agent detection won't work, but you can still use runtime detection
1 reply
0 recast
1 reaction
NelsonRodMar.eth
@nelsonrodmar
Ok so I really need to refactor it, because this library is implemented everywhere in the code that I'm trying to implement as MiniApps to detected and adapt to be a mobile website Thx for the information, let's go refactor everything
0 reply
0 recast
2 reactions