0

Add JS in <head> tag

asked 2022-10-21 00:47:03 +0800

manuela0000 gravatar image manuela0000
7 1

Hello everybody! I'm using ZK 9.6.0.1, I need to insert a new .js file in the <head> tag of the generated html. How can I do this?

Thank you.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-10-24 15:00:34 +0800

MDuchemin gravatar image MDuchemin
2480 1 6
ZK Team

Hello there!

This was actually discussed in last week's public training!

The short answer is, you have 3 ways to insert a script into the head of the generated HTML.

One a single page: You can use a processing instruction: https://www.zkoss.org/wiki/ZUMLReference/ZUML/ProcessingInstructions/script

Globally through your whole application: you can use lang-addon: https://www.zkoss.org/wiki/ZKClient-sideReference/Language_Definition/javascript

From Java: you can add arbitrary tags before or after the ZK generated headers, by getting the page, casting it as PageCtrl and using addBeforeTags or addAfterTags https://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/sys/PageCtrl.html#addAfterHeadTags-java.lang.String-

link publish delete flag offensive edit

Comments

thank you thank you! It works!! :)

manuela0000 ( 2022-10-31 19:33:05 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2022-10-21 00:47:03 +0800

Seen: 7 times

Last updated: Oct 24 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More