Skip to content

Commit

Permalink
add pageNavigationEvent for Safari (#2923)
Browse files Browse the repository at this point in the history
  • Loading branch information
miherlosev authored Jul 12, 2023
1 parent 1ebabcd commit 7f44edb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ class Hammerhead {
this.win.location.reload();
});
}

if (browserUtils.isSafari || browserUtils.isIOS)
this.pageNavigationWatch.onNavigationTriggered(navigationUrl);
}

start (initSettings: HammerheadInitSettings, win: Window & typeof globalThis): void {
Expand Down
8 changes: 8 additions & 0 deletions test/client/fixtures/page-navigation-watch-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,3 +516,11 @@ test('the onNavigationTriggered function should not throw an error when receives
});
});

if (browserUtils.isSafari && browserUtils.isOS) {
test('Raise PAGE_NAVIGATION_TRIGGERED event for "hammerhead.navigateTo" function', function () {
return navigateIframe('window["%hammerhead%"].navigateTo("./index.html");')
.then(function (url) {
strictEqual(url, iframeLocation + 'index.html');
});
});
}

0 comments on commit 7f44edb

Please sign in to comment.