Krishna
Krishna

Reputation: 23

Responsive Website both mobile and phone, mingle both Reactjs and React native

I want to the responsive web app on Mobile and Web page. I have built a website on React js. I have brought that website using a web view to React native and made it a mobile app. Now I need to direct my users depending upon the platform. If they are mobile users I need to direct them to React native app(live on the browser) and if they use the system they should be seeing the website I build. How can I do that? Is it possible? Suggest me a better Idea.

Upvotes: 0

Views: 295

Answers (2)

Ashish
Ashish

Reputation: 4330

You can achieve this using your backend code by checking request user agent if you get mobile, you can redirect to some other url (Probably play store).

You can do the same via front end JS also (not advisable). You can use these methods to detect if the user is on mobile, based on that redirect it to play store.

Upvotes: 1

EQuimper
EQuimper

Reputation: 5929

Check if the navigator userAgent is mobile or not. If mobile add a links to your app or app store to download it.

if (/Mobi|Android/i.test(navigator.userAgent)) {
    // if I'm here that mean I'm a phone
}

Upvotes: 0

Related Questions