EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 367 forks source link

[FIXED] Height changes after linking with the scheme #317

Closed sjoerdloeve closed 4 years ago

sjoerdloeve commented 4 years ago

A strange behavior happens if you have your app already running. As soon as you click the mycoolapp:// URL it moves to the app but make the HTML element bigger. But if you don't have the app running and click the URL it's all fine.

The added height is exact the size of the safe-area properties.

Tested with:

sjoerdloeve commented 4 years ago

Created a simple work around for now:

Check for document height and screen height and if they don't match, remove class default from the HTML attribute.

if(document.documentElement.scrollHeight !== screen.height) {
    document.documentElement.classList.remove("default");
}

CSS example:

html
{
    height: 100%;
    width: 100%;
}

html.default {
    height: calc(100% + env(safe-area-inset-top, 0) + env(safe-area-inset-bottom, 0));
}
sjoerdloeve commented 4 years ago

Found an easier solution: Add height=device-height to the viewport meta tag:

sjoerdloeve commented 4 years ago

The problem is caused by the Cordova Keyboard plugin and not this plugin. Issue can be closed.