You can use the 'Execute JavaScript' action in the browser object. For more complicated bespoke functionality I'd recommend writing a plugin.
Pausing the game whilst a modal appears is perfectly possible.
Bare in mind that wrappers like CocoonJS are DOM-less so HTML won't work when using them.