I have a page that needs to access to window.safari.pushNotification
. Everything works fine when you load that page. However when this page is included in a iframe window.safari
is undefined
.
This problem occurs even when you are on the same origin and even adding
sandbox="allow-forms allow-popups allow-pointer-lock allow-same-origin allow-scripts allow-top-navigation"
doesn't solve the problem.
Is it an intended behavior or a bug? Is there any work around to access window.safari
from inside an iframe? (I really need it)
It is simple to reproduce this issue. Just add the following code to a page and try:
- to load it directly
- to include it in another page using an iframe
window.addEventListener('load', function () {
console.log('safari' in window)
});