Skip to content

Commit

Permalink
fix: navigating to external url in cordova iOS
Browse files Browse the repository at this point in the history
Workaround to `event` object not containing A node in Safari.
  • Loading branch information
davidyuk committed Jan 24, 2024
1 parent f486525 commit 26e815e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/AeLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
v-else
class="ae-link"
:href="to"
:target="isLinkOnSameHost ? '_self' : '_blank'"
:target="target"
@click="clickHandler"
>
<slot />
Expand All @@ -32,12 +32,14 @@ export default {
useRouterLink() {
return this.$options.components.RouterLink && this.isLinkOnSameHost;
},
target() {
return this.isLinkOnSameHost ? '_self' : '_blank';
},
},
methods: {
clickHandler(event) {
const { target, href } = event.target;
if (process.env.VUE_APP_CORDOVA && target === '_blank') {
cordova.InAppBrowser.open(href, '_system');
if (process.env.VUE_APP_CORDOVA && this.target === '_blank') {
cordova.InAppBrowser.open(this.to, '_system');
event.preventDefault();
}
},
Expand Down

0 comments on commit 26e815e

Please sign in to comment.