Including .JS on one page
Including .JS on one page
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...
- Brian|Dyalog
- Posts: 120
- Joined: Thu Nov 26, 2009 4:02 pm
- Location: West Henrietta, NY
Re: Including .JS on one page
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:
I hope this helps!
/Brian
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:
- use _html.script - this is the base HTML5 <script> element.
(Add _html.script).Attr[⊂'src']←⊂'yourJSFile.js'
- use _HTML.Script - this is the "augmented" version
(Add _HTML.Script).File←'yourJSFile.js'
Add _html.script 'alert("hello")'
Add _HTML.Script 'alert("hello")'
I hope this helps!
/Brian
Re: Including .JS on one page
Thanks Brian, that's a nice solution and certainly helps :)