Hi all,
I am coming to Wix from Webflow. On Webflow, it is very easy to have a landing page with an HTML embed that redirects to the Google Play store or AppStore based on the device of the user. While I’ve been enjoying Wix, it is nowhere near as easy to set up here.
I’ve played around with a few options, including setting up a router to redirect to either an /appleredirect or /googleredirect page and doing an external redirect from there. However, building out the router is giving me some issues.
I’ve tried to follow the documentation for router but it is giving me some issues. Does anyone have a good function for the router that can determine operating system or find a substring in userAgent and redirect from there? I already have physical QR codes printed and distributed that are redirecting to this page, so changing the url isn’t really an option.
You are searching for DEVICE-TYPE ?
I don’T understand all your description, but i understood your question…
I had looked at this, but I need to know if it is an Apple or Android device and not just if it is a mobile device. Is there a way to see if it is Apple or Android using formFactor?
Now i got what you mean.
var userAgent = navigator.userAgent;
// Check if the user agent contains "Android" or "iPhone" to determine the device
if (userAgent.includes("Android")) {
console.log("User is using an Android device");
} else if (userAgent.includes("iPhone")) {
console.log("User is using an Apple device");
} else {
console.log("Device is not recognized as Android or iPhone");
}
You will have to use an HTML-Component or a custom element. I would suggest to use the HTML-Component, since it is simpler and faster to create a running function you need.
Implement the shown code inside your HTML-Component. Code a connection to your site inside of your HTML-Component.
Taht means…
-
Event-trigger on your Wix-Page → sending request for USER-AGENT, to check for DEVICE.
-
INSIDE HTML-COMPONENT → result will be generated.
-
HTML-Component send back result to Wix-Page.
-
Now you can do what ever you want with the result on your Wix-Page.