Script Fragments
ScriptRunner allows you to customise the UI of Confluence by adding buttons or displaying web content on a page.
There are two different types of Script Fragments available:
Web Items
Web Panels
Web Items
Web Items allow you to add a button to a specific location in the UI.
You can use web items to achieve the following:
Redirect users to another location
Display content from other websites
Automate functionality
Web Panels
Web panels can be used to add HTML snippets to parts of a page.
You can use Web Panels to display additional information on the current wiki page, or Jira issue etc.
For more information about web panels see Atlassian’s documentation.
How to use Script Fragments
General
Navigate to the Script Fragments section in the ScriptRunner menu
Click on Add fragment
Select the space where you want the fragment to appear
Select your fragment type, either Web Item or Web Panel
Web Item Specific
Select one of six different locations that you want the item to appear in.
Select either the Render External or HtmlCssJs options int he Rendering Mode dropdown
The Render External option will link a webpage to your web item, displaying it in a pop-up box where the Web Item is located
The HtmlCssJs option will allow you to inject an HTML URL, CSS and JavaScript into your button
If you’ve selected the Render External option, add your target URL
If you’ve selected the HtmlCssJs option, add your HTML URL, CSS URL and JavaScript URL to the Web Item
Click Save changes
Web Panel Specific
Select one of six different locations that you want the item to appear in.
Select either the Render External or HtmlCssJs options int he Rendering Mode dropdown
The Render External option will link a webpage to your web item, displaying it in a pop-up box where the Web Panel is located
The HtmlCssJs option will allow you to inject an HTML URL, CSS and JavaScript into your button
If you’ve selected the Render External option, add your target URL
If you’ve selected the HtmlCssJs option, add your HTML URL, CSS URL and JavaScript URL to the Web Panel
Click Save changes
The HTML, CSS and Javascript has to be hosted somewhere that Confluence can access. We recommend CodePen for the hosting. It’s also important to note that the hosting must serve up the matching content-type header for each file.