handle is_safari in iframe

This commit is contained in:
Maxim Devaev 2022-04-26 03:16:00 +03:00
parent 10b8215f4e
commit 720299e386

View File

@ -348,15 +348,22 @@ export var tools = new function() {
// Firefox 1.0+
let is_firefox = (typeof InstallTrigger !== "undefined");
// Safari 3.0+ "[object HTMLElementConstructor]"
// Safari 3.0+ "[object HTMLElementConstructor]"
let is_safari = (function() {
if (/constructor/i.test(String(window["HTMLElement"]))) {
return true;
}
if (!window.top["safari"]) {
return false;
let push = null;
try {
push = window.top["safari"].pushNotification;
} catch {
try {
push = window["safari"].pushNotification;
} catch {
return false;
}
}
return String(window.top["safari"].pushNotification) === "[object SafariRemoteNotification]";
return String(push) === "[object SafariRemoteNotification]";
})();
// Chrome 1+