Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Delete iOS target=_blank Links

Camilo edited this page Sep 9, 2021 · 1 revision

There is a known bug in Safari and Safari webview apps that using links with target=_blank in <a> tags. With this Quick fix you can delete those properties without modifying your website.

Load this script inside your custom.js

jQuery(document).ready(() => {

    // small fixes to the website

    // Remove Target _blank because they mess with iOS navigation
    jQuery('a[target="_blank"]').removeAttr("target");
    $agent.logger.log("Fixes Loaded");
    
});

As you can see it uses jQuery so either your website already loads it or you can inject it before that function inside your custom.js Also check https://youmightnotneedjquery.com/ if you would like to avoid jQuery at all.

Clone this wiki locally