Hi , I am trying hide elements between desktop and tablet using wixWindow.formFactor.
But when I check form factor on IPad, it is displaying as “Desktop”. Is there a workaround for this?
This is affecting the look and feel of my website layout between the 2.
Is there a way to get the device name (Like IPad or IPhone or mac etc…) where it is browsed from? If the above does not have a workaround, then we could code using the device name.
I did it already on my site https://www.corvidplayground.com/browser-detect - it also detects iPhones and ipads…
here is the HTML code (got it from open source browser-detect-npm)-> (i am not able to paste it here because I think its too long, so I added it to my wix-page)
just post to your Wix site the browser object and then you can manipulate your page as you wish.
To add to Gal’s comment above, you will always get desktop on an iPad. https://support.wix.com/en/article/troubleshooting-ipad-and-tablet-live-site-issues Wix sites are compatible for viewing on iPads and tablets. On Android tablets, visitors see themobile-friendly versionof your site. On iPads, visitors see the desktop version of your site.
userAgent
Returns the user-agent header as sent from the device used to make the router request.
Examples
Get the user-agent header of the device used to make the router request
export function myRouter_Router(request) {
let userAgent = request.userAgent;
// "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
}
You said: " I see in Macbook and IPad, the OS shows as “Mac OS”"
I’ve tested and had the same results. I don’t see a way to distinguish between ipad and desktop using this approach. What did you do in the end? Thanks