Page 1 of 1
Including .JS on one page
Posted: Tue Dec 02, 2014 5:34 am
by MBaas
I'd like to include a specific <script>-reference in the <head> of a certain MiPage. Is there way to do that from within the page or would I have to fiddle with the wrapper? (I've seen that I can Add meta from the page and it will appear in the head, but script unfortunately was injected in the body...
Re: Including .JS on one page
Posted: Thu Dec 04, 2014 8:35 pm
by Brian|Dyalog
Hi Michael!
I've posted an update to GitHub
https://github.com/Dyalog/MiServer which fixes this. I had implemented some intelligence to properly locate elements that belong in <head> or <body>, but apparent it wasn't working completely correctly. That's been fixed with the 4 December 2014 update.
There are a couple of ways in include scripts:
If you're using inline code as opposed to storing your JavaScript in a separate file, you can provide the code as an argument using either control:
Add _html.script 'alert("hello")'
Add _HTML.Script 'alert("hello")'
I hope this helps!
/Brian
Re: Including .JS on one page
Posted: Fri Dec 05, 2014 9:27 am
by MBaas
Thanks Brian, that's a nice solution and certainly helps :)