Skip to content

Commit bcf591a

Browse files
authored
IBX-11363: Merged branch '4.6' into 5.0 (#2006)
2 parents e953062 + 3878286 commit bcf591a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/bundle/Resources/public/js/scripts/admin.prevent.click.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
(function (global, doc) {
2+
let isExternalProtocolNavigation = false;
3+
4+
doc.addEventListener(
5+
'click',
6+
(event) => {
7+
const link = event.target.closest('a[href]');
8+
9+
isExternalProtocolNavigation = !!link && !['http:', 'https:'].includes(link.protocol);
10+
},
11+
true,
12+
);
13+
214
global.onbeforeunload = () => {
15+
if (isExternalProtocolNavigation) {
16+
isExternalProtocolNavigation = false;
17+
18+
return null;
19+
}
20+
321
doc.querySelector('body').classList.add('ibexa-prevent-click');
422

523
return null;

0 commit comments

Comments
 (0)