########################################################################################## FKAMP-5: See if we can find a way to handle AMP on Google News ########################################################################################## Issue Type: Improvement ----------------------------------------------------------------------------------------- Issue Information ==================== Priority: Major Status: Closed Resolution: Done (2019-06-11 18:18:55) Project: Anti-AMP Scripts (FKAMP) Reported By: btasker Assigned To: btasker Targeted for fix in version: - v1.4.21 Time Estimate: 0 minutes Time Logged: 0 minutes ----------------------------------------------------------------------------------------- Issue Description ================== FKAMP-4 ultimately implemented a script to redirect Google News to Bing news as a workaround for Google having made Google News extremely hostile. It's not a great long-term solution though, so really need to look at trying to get AMP detection working on Google News ----------------------------------------------------------------------------------------- Issue Relations ================ - relates to FKAMP-4: Redirect Away from Google News - relates to FKAMP-6: Parse AMP CDN Urls to decide whether to redirect to HTTP or HTTPS ----------------------------------------------------------------------------------------- Activity ========== ----------------------------------------------------------------------------------------- 2019-06-11 17:40:21 btasker ----------------------------------------------------------------------------------------- So, looking at this some more (as I don't think redirects to alternate services are a good long term solution), I've noticed a couple of things: - If you force a link to open in a new tab, Google then redirects you to the proper page - Just like in the search results (FKAMP-2) the actual AMP content is served in an iframe directed at ampproject.org So, there are potentially two options here. - We *could* iterate over all links on a page and add target=_blank to them (remembering to also add rel="noopener noreferrer" so that the new page doesn't have access to the Google search tab via window.opener) - Or, as was originally implemented as a possible fix for FKAMP-2, we could search for the iframe and then try and trigger a redirect if that's present The first feels a bit messier, but the second has a couple of additional drawbacks. Firstly, it means a request still has to go out to foo-bar-sed.cdn.ampproject.org so you've got additional latency there, plus if *.cdn.ampproject has been blocked in the user's browser we'll never get the info back. For some reason, even with all my scripts turned off, the iframe removes itself after a few seconds if I open developer tools. Anyway the outer HTML for the iframe is -- BEGIN SNIPPET -- -- END SNIPPET -- So, what we _may_ want to look at doing is checking for iframe elements, for any that are found check whether their src contains cdn.ampproject and if it does rewrite the window location to be that value (so the normal triggers can fire). That's not perfect, but should work in principle ----------------------------------------------------------------------------------------- 2019-06-11 17:44:48 git ----------------------------------------------------------------------------------------- -- BEGIN QUOTE -- Repo: RemoveAMP Commit: c104941e180d239ee9cfa53b250dd67f3a6dbd12 Author: B Tasker