Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work on iOS Web apps (homescreen) #6

Open
einzelfabrik opened this issue Jul 4, 2018 · 3 comments
Open

Does not work on iOS Web apps (homescreen) #6

einzelfabrik opened this issue Jul 4, 2018 · 3 comments

Comments

@einzelfabrik
Copy link

einzelfabrik commented Jul 4, 2018

A simple and good idea is the script. Unfortunately, it only works for pages that are called directly in the browser (Safari). If you use the web app functions in iOS and place a link on the homescreen it doesn't work. Example: http://Piepmatz.einzelfabrik.de/index4.php
In my case I only want to allow portrait mode - and forbid landscape.

What can I change?

@WuglyakBolgoink
Copy link

@einzelfabrik are you found something else?

@equinoxe3d
Copy link

equinoxe3d commented Jan 6, 2021

Had the same issue and solved the problem by modifying the isPortrait() function in pleaserotate.js (line 179) to use another viewport measure than window.innerWidth/innerHeight, which seems to be spotty on iOS:
iOS return bad value for window.innerHeight/Width

In my case I went for document.documentElement.clientWidth/clientHeight (mentioned in the link above) and it works perfectly in both webapp/browser modes now.

function isPortrait(){
    return (document.documentElement.clientWidth < document.documentElement.clientHeight);
}

Hope it helps!

@arscan
Copy link
Owner

arscan commented Jan 6, 2021

Thanks @equinoxe3d -- if this solution has better cross-browser / platform compatibility I'd be happy to merge in a PR with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants