MediaWiki:Common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 847: Line 847:


function showIOSAppDownloadLink() {
function showIOSAppDownloadLink() {
    // JavaScript code to check if the user is on a mobile device and not using the iOS app
     if (window.navigator.userAgent.match(/iPhone|iPad|iPod/i) && !window.navigator.userAgent.includes('gonative melvorwiki')) {
    // If the conditions are met, populate the 'ios-app-download' div with a link to the iOS app.
         const els = document.getElementsByClassName('ios-app-download');
    var iOSAppURL = 'YOUR_IOS_APP_URL';
         els.forEach((el) => {
 
        el.style.display = 'show';
     if (window.navigator.userAgent.match(/iPhone|iPad|iPod/i) && !window.navigator.userAgent.match(/Your iOS App User-Agent String/i)) {
        });
        var downloadLink = '<a href="' + iOSAppURL + '">Download the iOS App</a>';
         const el = document.getElementById('ios-app-download');
         if(el !== null) el.innerHTML = downloadLink;
     }
     }
}
}