Skip to content

Commit

Permalink
check for webkit object as well as useragent (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadsr authored Jun 28, 2024
1 parent 4039a44 commit 41779bb
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion assets/ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ let windowHeight = window.innerHeight;
let formButtonText = '';
let formWorker: Worker | undefined = undefined;

declare global {
interface Window {
webkit?: {
messageHandlers: {
[x: string]: {
postMessage: (data: string) => void;
};
};
};
}
}

/**
* Interface for the ContactForm type. This defines the structure of the contact form fields.
*/
Expand Down Expand Up @@ -201,7 +213,10 @@ const compareVersions = (version1: string, version2: string) => {
document.addEventListener('DOMContentLoaded', function () {
const cube = document.getElementById(CUBE_ID);
if (cube) {
if (navigator.userAgent.indexOf('AppleWebKit') !== -1) {
if (
window.webkit &&
navigator.userAgent.indexOf('AppleWebKit') !== -1
) {
const versionMatch = navigator.userAgent.match(
/Version\/(\d+(\.\d+)*)/
);
Expand Down

0 comments on commit 41779bb

Please sign in to comment.