vihanb / PPCG-Design

A redesign of the PPCG website
codegolf.stackexchange.com
35 stars 14 forks source link

Non-https TIO links trigger mixed-content warnings and display empty results element #122

Open ephphatha opened 7 years ago

ephphatha commented 7 years ago

The regex looking for the protocol/host part of TIO links (around line 773 in function breakoutTIOLinks()) picks up http and https links then performs an XMLHttpRequest with the URL using whatever the protocol was. Now that PPCG is using HTTPS older HTTP links get blocked due to the browser mixed-content policy.

This case does not get handled as an error/exception so the code that appends the response runs and creates the results element with an invalid/shared id and no content. Rewriting the protocol to use HTTPS would probably be easier, otherwise I'd expect the script to handle that case as an error and not append the results element.

I saw that #73 is still open but figured it was worth making a new issue for this since it's a different error, I can move this to a comment on that issue if preferred.

RikerW commented 6 years ago

No repro. (OS X with safari, firefox, chrome, vivaldi)

ephphatha commented 6 years ago

For reference the following page triggers mixed content warnings in Chrome 64.0.3282.186 on Windows 10 on at least 10 answers - https://codegolf.stackexchange.com/questions/102370/add-a-language-to-a-polyglot?answertab=oldest#tab-top

Answer 4 is the first http tryitonline.net link.

Given tryitonline.net 301's to tio.run the link parsing needs to be updated anyway so this is probably not worth addressing on its own.