window.webkit.messageHandlers is defined in an iOS Chrome & Firefox browser which is not in a Webview

  Kiến thức lập trình

I was under the assumption that webkit.messageHandlers are defined on iOS in a webview context. But when I do an alert of this, I get some kind of “value” that I cannot look into.

Can I get some clarity on this, and if someone has a more elegant way to check if a particular page is being displayed inside an iOS webview.

const isIOS = () => {
    alert(window.webkit?.messageHandlers)
    return window.webkit && window.webkit?.messageHandlers
}

enter image description here

LEAVE A COMMENT