Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can use scripted SVG in combination with github pages HTML using:

<embed src="scripted-svg.svg" type="image/svg+xml" width="200" height="200">

I couldn't get it working with README.md, so tipping the hat to the author!

The only problem and with the experience I got trying using it, is that the concept of viewport is botched. I was hoping that the embedded JS would have working metrics for the viewed width/height, which it does not.

That means that mouse events and such have transformed coordinates, not matching the position of the cursor.

I have this small project demonstrating the ways embedded JS gets rendered. I think I'm going to revise it and see if both projects can be merged.

https://github.com/xyzzy/scripted-svg



The whole point is that SVG images are basically never loaded with the embed tag, which is the reason why this is innocuous.

Embed is basically like using iframe, so where one is blocked, the other one is too.

The author simply loaded the SVG via the image tag, which renders it inert.


True, I started optimistic seeding much potential in possibilities to extend HTML only to discover that embedded javascript only works when the SVG is the main URL target or wrapped in <object> or <iframe>. Sad actually.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: