add script or other tag to html head on ViewChange

Hi there,
I need to add some html snippets into the html head only after a specific ViewChange using Navigator.
For example:
navigate to View2 → do nothing
navigate to View3 → add script tag into html head

is there a possibility to achieve this?

Thanks in advance

You might be able to do this with an Extension, perhaps most concisely with a JavaScriptExtension if you are familiar with JS.

EDIT: or even easier with JavaScript.eval(…) with a piece of JS that injects the script tag.