Skip to content

Instantly share code, notes, and snippets.

@AramZS
Created February 18, 2021 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AramZS/ec24c7242c2cb46d7dbfaeb376f0f704 to your computer and use it in GitHub Desktop.
Save AramZS/ec24c7242c2cb46d7dbfaeb376f0f704 to your computer and use it in GitHub Desktop.
Apple News Redirect Page
<!DOCTYPE html>
<html class="js no-touch svg no-oldie no-ie" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
prefix="og: http://ogp.me/ns#">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1" />
<script type="text/javascript">
if (window.self === window.top) {
window.onload = function() {
if (!String.prototype.includes) {
String.prototype.includes = function(search, start) {
'use strict';
if (typeof start !== 'number') { start = 0; }
if (start + search.length > this.length) { return false; }
else { return this.indexOf(search, start) !== -1; }
};
}
var curUserAgent = navigator.userAgent.toLocaleLowerCase();
if (shouldRedirectToApp(curUserAgent)) {
window.location = "applenewss://apple.news/A5ezLg2BeSmyA4hGAoBjYaw";
if (shouldRedirectToCanonicalUrl(curUserAgent)) {
redirectToUrlAfterTimeout("https://www.manchestereveningnews.co.uk/whats-on/family-kids-news/covid-virus-young-children-common-19864218", 0);
}
} else if (!isSocialMediaBot(curUserAgent)) {
if (shouldRedirectToCanonicalUrl(curUserAgent)) {
redirectToUrl("https://www.manchestereveningnews.co.uk/whats-on/family-kids-news/covid-virus-young-children-common-19864218");
}
}
function shouldRedirectToApp(curUserAgent) {
var isIOSDevice = isIOS(curUserAgent);
var isMacOSDevice = isMacOS(curUserAgent);
var noArticleURL = false;
return (isIOSDevice && (isIOSRedirectApp(curUserAgent) || (noArticleURL && isIOSRedirectAppForNoURL(curUserAgent)))) || (isMacOSDevice && (isMacOSRedirectApp(curUserAgent) || (noArticleURL && isMacOSRedirectAppForNoURL(curUserAgent))));
}
function shouldRedirectToCanonicalUrl(curUserAgent) {
var isIOSDevice = isIOS(curUserAgent);
var isMacOSDevice = isMacOS(curUserAgent); return !(isIOSDevice && isIOSNoArticleURLRedirectApp(curUserAgent)) && !(isMacOSDevice && isMacOSNoArticleURLRedirectApp(curUserAgent));
}
function isIOS(curUserAgent) {
var iOS9Version = getVersionNumber(9, 0, 0);
var iOSPattern = /(?:ipad|ipod|iphone).* os (d+)(?:.|_)(d+)((?:.|_)(d+))? like mac os x/g;
var iOSVersion = matchAndGetVersion(curUserAgent, iOSPattern); return iOSVersion >= iOS9Version;
}
function isMacOS(curUserAgent) {
var macOS1014Version = getVersionNumber(10, 14, 0);
var macOSPattern = /mac os x (d+)(?:.|_)(d+)((?:.|_)(d+))?/g;
var macOSVersion = matchAndGetVersion(curUserAgent, macOSPattern);
return macOSVersion >= macOS1014Version;
}
function matchAndGetVersion(curUserAgent, versionPattern) {
var match = versionPattern.exec(curUserAgent);
if (match != null) {
var majorVersion = match[1] != null ? parseInt(match[1]) : 0;
var minorVersion = match[2] != null ? parseInt(match[2]) : 0;
var pointVersion = match[3] != null ? parseInt(match[3].substring(1)) : 0;
return getVersionNumber(majorVersion, minorVersion, pointVersion);
} return 0;
}
function getVersionNumber(majorVersion, minorVersion, pointVersion) {
return (majorVersion * (1000 * 1000)) + (minorVersion * 1000) + pointVersion;
}
function isSocialMediaBot(curUserAgent) {
return curUserAgent.includes("twitterbot") || curUserAgent.includes("facebookexternalhit") || curUserAgent.includes("facebot") || curUserAgent.includes("linkedinbot") || false;
}
function isIOSRedirectApp(curUserAgent) {
return curUserAgent.includes("fbav") || curUserAgent.includes("instagram") || curUserAgent.includes("fban/") || curUserAgent.includes("crios/") || false;
}
function isIOSRedirectAppForNoURL(curUserAgent) { return false; }
function isMacOSRedirectApp(curUserAgent) { return curUserAgent.includes("chrome/") || false; }
function isMacOSRedirectAppForNoURL(curUserAgent) { return false; }
function isIOSNoArticleURLRedirectApp(curUserAgent) { return curUserAgent.includes("crios/") || false; }
function isMacOSNoArticleURLRedirectApp(curUserAgent) { return curUserAgent.includes("chrome/") || false; }
function redirectToUrl(url) { top.location.replace(url); }
function redirectToUrlAfterTimeout(url, timeout) { setTimeout(function() { redirectToUrl(url) }, timeout); }
};
}
</script>
<title>Children aged five to 12 now in one of most common groups for Covid</title>
<meta name="Author" content="Manchester Evening News" />
<meta name="apple-itunes-app"
content="app-id=1066498020, app-argument=https://apple.news/A5ezLg2BeSmyA4hGAoBjYaw" />
<meta property="og:type" content="article" />
<meta property="og:title"
content="Children aged five to 12 now in one of most common groups for Covid — Manchester Evening News" />
<meta property="og:description" content="The research has raised further concerns over the reopening of schools" />
<meta property="og:image" content="https://c.apple.news/AgEXQTVlekxnMkJlU215QTRoR0FvQmpZYXcAMA" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Children aged five to 12 now in one of most common groups for Covid" />
<meta name="twitter:description" content="The research has raised further concerns over the reopening of schools" />
<meta name="twitter:image" content="https://c.apple.news/AgEXQTVlekxnMkJlU215QTRoR0FvQmpZYXcAMA" />
<link rel="shortcut icon" href="/images/favicon.ico" />
<link rel="apple-touch-icon" href="/images/apple-touch-icon.png" />
<link rel="stylesheet" href="https://www.apple.com/wss/fonts?families=SF+Pro,v1|SF+Pro+Icons,v1" type="text/css">
<link rel="stylesheet" href="/css/index.css" type="text/css" />
</head>
<body>
<div id="main">
<div class="content">
<div class="inner-content has-icon"> <img class="app-icon" src="/images/Appicon_v6.png" alt="Apple News"
srcset="/images/Appicon_v6.png 1x, /images/Appicon_v6@2x.png 2x, /images/Appicon_v6@3x.png 3x" />
<h1>Opening story…</h1>
<p><a
href="https://www.manchestereveningnews.co.uk/whats-on/family-kids-news/covid-virus-young-children-common-19864218"><span
class="click-here">Click here</span><span class="tap-here">Tap here</span></a> if the story
doesn’t open after a few seconds.</p>
<p><a class="more" href="https://www.apple.com/news/">Learn more about Apple News</a></p>
</div>
</div>
<div class="footer">
<ul class="menu policies">
<li class="item first"> <span class="icon icon-before icon-apple"></span> </li>
<li class="item"> <a href="https://www.apple.com/privacy/">Privacy Policy</a> </li>
<li class="item last"> <a href="https://www.apple.com/legal/internet-services/terms/site.html">Terms and
Conditions</a> </li>
</ul>
<div class="copyright"> Copyright © 2021 Apple Inc. All Rights Reserved. </div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment