Usages

This is a new feature in Joget DX 8.2.

A plugin that injects HTML into the page footer based on URL Patterns.

Common use cases:

  • Adding a floating chat window.
  • Insect custom script and CSS.
  • DOM modification.
  • A tracking script.

Interface Class

org.joget.plugin.base.UiHtmlInjectorPlugin

  • This plugin interface can be used together with other plugin types
  • It provided a set of URL Patterns to inject the HTML and the HTML to inject into the page footer.
  • URL Patterns follow the AntPathMatcher syntax, which is wisely used in the Spring Framework.
  • For the AJAX UI Theme, there is an extra flag to decide whether to re-inject the HTML or not.

Interface Methods

getName

public java.lang.String getName()

Method returning a unique identifier of the injector

getInjectUrlPatterns

public java.lang.String[] getInjectUrlPatterns()
    • Method returning a URL pattern array to inject HTML.
    • The URL pattern using AntPathMatcher syntax.

getHtml

public java.lang.String getHtml(HttpServletRequest request)

Method returning the HTML to inject into the page footer

isIncludeForAjaxThemePageSwitching

public boolean isIncludeForAjaxThemePageSwitching()

A flag to tell if the HTML needs to be re-injected when the AJAX theme page is switched.

Abstract Class

org.joget.apps.app.model.UiHtmlInjectorPluginAbstract

  • Extended ExtDefaultPlugin.
  • Implemented UiHtmlInjectorPlugin.

Sample Plugins

  • SampleChatUiHtmlInjector
    • It injected a web socket chat feature to all the UI pages with URL pattern /web/userview/**.
    • The chat will stay there even after the AJAX theme switches pages.
  • SampleLogUrlUiHtmlInjector
    • It injects a script to log the current page URL into all pages with the URL pattern /**.
    • The script will print out the log even AJAX theme switch page.
  • No labels