I would like to open server pages outside my domain in an In-App Browser.
- In my capacitor.config.json I have added my domain with server.allowNavigation: [“myurl.com”]
- I tried to add the following in my server website code, which doesn’t work:
window.addEventListener('click', e => {
if (Capacitor.isPluginAvailable('Browser') && e.target.closest('a')) {
// open our search results in an in-app browser
e.preventDefault();
Capacitor.Plugins.Browser.open({
url: e.target.closest('a').getAttribute('href'),
});
}
});
What should I do?