alin23 / sidehn

Browser extension that shows a sidebar with HN comments if the link was opened from HN
GNU General Public License v3.0
46 stars 1 forks source link

Fails on some URLs (bmj.com) #1

Open huyz opened 6 months ago

huyz commented 6 months ago

Doesn't seem to work on https://news.ycombinator.com/item?id=39803845

alin23 commented 6 months ago

Yes, there are many such URLs, it can't possibly work on every web page. PRs are welcome :)

huyz commented 6 months ago

Why can't it possibly work on every page? I didn't look deep enough into the code to make that obvious. Are you using some hack or are you fighting web-page specific restrictions?

alin23 commented 6 months ago

I'm modifying the HTML by adding a new node for the sidebar and moving the whole body into an inner node so that it can be shifted to the left of the sidebar.

If the page has JS that re-renders the page and changes the HTML structure, then the changes of this extension will be removed or may cause odd layout issues.

huyz commented 6 months ago

Ah I see. Good to know.

https://bsky.app may be a good first candidate to play with as it may be a common site to link to…

alin23 commented 6 months ago

Most such dynamic websites react to DOM tree changes and usually re-render the page. I doubt there is any way to make this extension work well with feed sites like Bluesky or Twitter.

I simply disable the extension on these websites, it doesn't have to work everywhere. It's good enough that it works on blogs, journals and other static websites.