I have done this via the server generating JavaScript that is eval'd client side. If JavaScript is disabled, the modal is opened on a new page instead.
What are some good patterns to enable this, while also having a safe fallback for when JavaScript is disabled?
A couple of data-* attributes can help control the specific behaviour of the JavaScript meaning you probably don’t need inline/page specific is code for every instance.
This isn’t a new approach, we were doing this back when IE6 was the “mainstream” browser.