Font Size:

UI HTML Injector Plugin

Introduction

A plugin that Inject HTML to page footer based on URL Patterns.

Commons Use Cases:

  • Adding floating chat window

  • Insect custom script and css

  • DOM modification

  • Tracking script

UI HTML Injector Plugin Class

Interface

  • org.joget.plugin.base.UiHtmlInjectorPlugin

    • This plugin interface can used together with other plugin types

    • It provided a set of URL Patterns to inject the HTML and the HTML to inject to page footer.

    • URL Patterns are following AntPathMatcher syntax which is wisely used in Spring Framework.

    • For AJAX UI Theme, there is extra flag to decide whether to re-inject the HTML or not.

Abstract

  • org.joget.apps.app.model.UiHtmlInjectorPluginAbstrac

    • Extended ExtDefaultPlugin and implemented UiHtmlInjectorPlugin

org.joget.plugin.base.UiHtmlInjectorPlugin

Methods

  • String getName()

    • Method returning a unique identifier of the injector

  • String[] getInjectUrlPatterns()

    • Method returning a URL patters array to inject HTML

    • The url pattern using AntPathMatcher syntax

  • String getHtml(HttpServletRequest request)

    • Method returning the HTML to inject to page footer

  • boolean isIncludeForAjaxThemePageSwitching()

    • A flag to tell the HTML need to re-injecting when AJAX theme page switching.

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 the AJAX theme switch page.

  • SampleLogUrlUiHtmlInjector

    • It inject a script to log the current page URL into all pages with URL pattern “/**”

    • The script will print out the log even AJAX theme switch page.

Created by Debanraj Last modified by Debanraj on Apr 17, 2025