https://www.heise.de/tipps-tricks/Excel ... 88585.html
Tested with a clean installation.
Error
Code: Select all
Timestamp: 25.10.2022 10:43:43
Error: TypeError: t.customElements is undefined
Source File: https://cdn.ampproject.org/v0.mjs
Line: 2
Moderator: trava90

Code: Select all
Timestamp: 25.10.2022 10:43:43
Error: TypeError: t.customElements is undefined
Source File: https://cdn.ampproject.org/v0.mjs
Line: 2







Brave recently added support for redirection to non AMP pages.andyprough wrote: ↑2022-10-25, 14:00Brave and DuckDuckGo browser are somehow serving up the "original" non-AMP pages for a lot of these AMP sites.
andyprough wrote: ↑2022-10-25, 14:00maybe a Pale Moon extension could copy the technique and serve up a non-AMP page?


Sorry, don't know how I missed your link to the greasemonkey script post before I asked for an extension. Lack of sleep lately has turned my postings into mindless mush, I think.

Code: Select all
// ==UserScript==
// @name Nuke AMP
// @namespace moonbat
// @description Redirect AMP to non AMP
// @include *://*/*
// @version 1
// @grant none
// ==/UserScript==
window.addEventListener ("DOMContentLoaded", nukeAMP, false);
function nukeAMP(){
// Check whether it's AMP html
var h = document.getElementsByTagName('html');
if (h[0].getAttribute('amp-version') != null || h[0].getAttribute('amp') != null || h[0].getAttribute('⚡') != null || document.location.href.substr(0,29).toLowerCase() == 'https://www.google.com/amp/s/'){
console.log("Found AMP page, trying to redirect...");
// Try and find a canonical link
eles = document.getElementsByTagName('link');
for (var i=0; i<eles.length;i++){
if (eles[i].getAttribute('rel') == 'canonical' && eles[i].getAttribute('rel') != window.location.href.split('#')[0]){
window.location.replace(eles[i].getAttribute('href'));
console.log("Redirecting you to "+eles[i].getAttribute('href'));
return;
}
}
// If we got this far, there's no canonical :(
console.log("Sorry, but you're stuck with the sucky version of this page. Maybe search for the proper version?");
// Build a link to search DuckDuckGo for the page title (to hopefully find the proper version)
t = document.getElementsByTagName('title')[0];
qs = encodeURIComponent(t.innerHTML);
searchurl = 'https://duckduckgo.com/?t=hg&ia=web&q='+qs
altlink = document.createElement('a');
altlink.href = searchurl;
altlink.title = 'Try and find a proper version of this page';
altlink.innerHTML = 'Search for a non-AMP version of this page';
// Drop the link in at the top
document.body.insertBefore(altlink, document.body.firstChild);
}
}


This script is interesting - it tries to work but just keeps auto refreshing over and over, giving off a message each time as if it did find an alternate page:moonbat wrote: ↑2022-10-26, 00:54The script helpfully adds links to a DDG search of the original URL at the top of the page in case it can't find an alternative.
I just merged this script together into a single file without dependency on his server (the original version was simply fetching the parsing function from the server), and removed the annoying console message for when the page isn't an AMP one -
Code: Select all
Found AMP page, trying to redirect...
Nuke_AMP.user.js:15:9
"Redirecting you to https://www.heise.de/tipps-tricks/Excel-Tabellen-vergleichen-so-geht-s-4988585.html"
Nuke_AMP.user.js:23:17
Code: Select all
// ==UserScript==
// @name Nuke AMP
// @namespace moonbat
// @description Redirect AMP to non AMP
// @include *://*/*
// @version 1
// @grant none
// ==/UserScript==
window.addEventListener('DOMContentLoaded', nukeAMP, false);
function nukeAMP() {
// Check whether it's AMP html
var h = document.getElementsByTagName('html');
if (h[0].getAttribute('amp-version') != null || h[0].getAttribute('amp') != null || h[0].getAttribute('â¡') != null || document.location.href.substr(0, 29).toLowerCase() == 'https://www.google.com/amp/s/') {
console.log('Found AMP page, looking for redirect...');
// Try and find a canonical link
eles = document.getElementsByTagName('link');
for (var i = 0; i < eles.length; i++) {
if (eles[i].getAttribute('rel') == 'canonical' && eles[i].getAttribute('href') != window.location.href.split('#') [0]) {
letnonAMP = eles[i].getAttribute('href');
window.location.replace(nonAMP);
console.log('Redirecting you to ' + nonAMP);
return;
}
} // If we got this far, there's no canonical :(
console.log('Sorry, but you\'re stuck with the sucky version of this page. Maybe search for the proper version?');
// Build a link to search DuckDuckGo for the page title (to hopefully find the proper version)
t = document.getElementsByTagName('title') [0];
qs = encodeURIComponent(t.innerHTML);
searchurl = 'https://duckduckgo.com/?t=hg&ia=web&q=' + qs
altlink = document.createElement('a');
altlink.href = searchurl;
altlink.title = 'Try and find a proper version of this page';
altlink.innerHTML = 'Search for a non-AMP version of this page';
// Drop the link in at the top
document.body.insertBefore(altlink, document.body.firstChild);
}
}

