Some images are partly broken / not shown on heise.de

For support with specific websites

Moderator: trava90

Forum rules
Please always mention the name/domain of the website in question in your topic title.
Please one website per topic thread (to help keep things organized). While behavior on different sites might at first glance seem similar, they are not necessarily caused by the same.

Please try to include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:
  1. Clear any current output
  2. Navigate or refresh the page in question
  3. Copy and paste Errors or seemingly relevant Warnings into a single [ code ] block.
User avatar
mseliger
Fanatic
Fanatic
Posts: 119
Joined: 2016-02-17, 10:53

Some images are partly broken / not shown on heise.de

Unread post by mseliger » 2022-10-25, 08:50

The images in this page are partly broken:
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
Palemoon Version 31.3.0.1 (64-bit) on Ubuntu Mate 22.04.
Last edited by Moonchild on 2022-10-26, 08:12, edited 1 time in total.
Reason: Mention the site in your topic
Mit freundlichen Grüßen / Greetings
Maria
---
Ich bin ein Westfale, und zwar ein Stockwestfale, nämlich ein Münsterländer – Gott sei Dank! füge ich hinzu ...
Annette von Droste zu Hülshoff, Bei uns zu Lande auf dem Lande

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 37517
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: Some images are partly broken / not shown

Unread post by Moonchild » 2022-10-25, 09:16

It's because they decided to use AMP which is a web component library that, well, uses Google's WebComponents :P

We don't support WebComponents (yet, or at least not fully, so it's disabled by default).

The interesting bit here is that some web research led me to the organization that actually drives all this web compatibility stuff we keep running into. It's the "OpenJS Foundation". Don't be fooled by te name or the fact it's been set up as a non-profit. This is all the big players come together to push the Javascript Storm that is actually favoring the Blink and V8 engine monoculture. Check out their governance team; note which companies they are employed by. https://openjsf.org/about/governance/
"A dead end street is a place to turn around and go into a new direction" - Anonymous
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5549
Joined: 2015-12-09, 15:45

Re: Some images are partly broken / not shown

Unread post by moonbat » 2022-10-25, 11:24

Apart from the privacy issues, it makes zero sense to use AMP for desktop browsers; the whole idea was to render it faster for mobiles.
Install this script for Greasemonkey and it will redirect you to the regular version of the page.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 37517
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: Some images are partly broken / not shown

Unread post by Moonchild » 2022-10-25, 12:02

Unfortunately it seems the GM script causes a load loop on that page?
"A dead end street is a place to turn around and go into a new direction" - Anonymous
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
andyprough
Board Warrior
Board Warrior
Posts: 1093
Joined: 2020-05-31, 04:33

Re: Some images are partly broken / not shown

Unread post by andyprough » 2022-10-25, 14:00

Brave and DuckDuckGo browser are somehow serving up the "original" non-AMP pages for a lot of these AMP sites. It seems from what I'm reading that the original page link is in the page source - maybe a Pale Moon extension could copy the technique and serve up a non-AMP page? Apparently AMP is a huge privacy problem, at least according to the press releases from the so-called "privacy" browsers.

User avatar
back2themoon
Moon Magic practitioner
Moon Magic practitioner
Posts: 2863
Joined: 2012-08-19, 20:32

Re: Some images are partly broken / not shown

Unread post by back2themoon » 2022-10-25, 20:19

There's also the AMP Hosts filterlist, but I don't think it helps in this case.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5549
Joined: 2015-12-09, 15:45

Re: Some images are partly broken / not shown

Unread post by moonbat » 2022-10-25, 23:12

andyprough wrote:
2022-10-25, 14:00
Brave and DuckDuckGo browser are somehow serving up the "original" non-AMP pages for a lot of these AMP sites.
Brave recently added support for redirection to non AMP pages.
andyprough wrote:
2022-10-25, 14:00
maybe a Pale Moon extension could copy the technique and serve up a non-AMP page?
See below. Even this userscript relies on a blocklist, so the AMP to non AMP isn't something as simple as detecting a URL pattern and redirecting it.
moonbat wrote:
2022-10-25, 11:24
Install this script for Greasemonkey and it will redirect you to the regular version of the page.


Edit - it doesn't. Dunno why he can't just include it as part of the GM script :wtf:
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
andyprough
Board Warrior
Board Warrior
Posts: 1093
Joined: 2020-05-31, 04:33

Re: Some images are partly broken / not shown

Unread post by andyprough » 2022-10-26, 00:43

moonbat wrote:
2022-10-25, 23:12
See below. Even this userscript relies on a blocklist, so the AMP to non AMP isn't something as simple as detecting a URL pattern and redirecting it.
moonbat wrote:
2022-10-25, 11:24
Install this script for Greasemonkey and it will redirect you to the regular version of the page.


Edit - it doesn't. Dunno why he can't just include it as part of the GM script :wtf:
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.

I wonder if the greasemonkey script works, but just not on the linked heise.de page - I don't see the non-amp url in the page's source. From what I was reading of the Brave and DDG work-around, it only works on pages where they are given an alternate link they can send readers to.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5549
Joined: 2015-12-09, 15:45

Re: Some images are partly broken / not shown

Unread post by moonbat » 2022-10-26, 00:54

The 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

// ==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);
    }
}
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
andyprough
Board Warrior
Board Warrior
Posts: 1093
Joined: 2020-05-31, 04:33

Re: Some images are partly broken / not shown

Unread post by andyprough » 2022-10-26, 13:16

moonbat wrote:
2022-10-26, 00:54
The 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 -
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:

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
But then it doesn't ever come up with an alternate page.

I don't know much about greasemonkey scripts. It seems like I added it in the customary way, as I now have a "Nuke AMP 1" listed in my User Scripts settings.

I think what I should be getting is the "Sorry, but you're stuck with the sucky version of this page. Maybe search for the proper version?" message, but instead it keeps auto-refreshing.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5549
Joined: 2015-12-09, 15:45

Re: Some images are partly broken / not shown on heise.de

Unread post by moonbat » 2022-10-27, 03:51

Yeah, I found a bug in the original script. Fixed it and it works now - you will get a link to DDG saying 'search for a non amp version of this page' at the top.

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);
  }
}
Just edit the existing user script from the Greasemonkey section in the addons manager and replace it with the above.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
andyprough
Board Warrior
Board Warrior
Posts: 1093
Joined: 2020-05-31, 04:33

Re: Some images are partly broken / not shown on heise.de

Unread post by andyprough » 2022-10-27, 14:21

moonbat wrote:
2022-10-27, 03:51
Yeah, I found a bug in the original script. Fixed it and it works now - you will get a link to DDG saying 'search for a non amp version of this page' at the top.
Yes, that works.