Skip to main content
Skip table of contents

WebResources

The WebResources placeholder can be used to apply Confluence styling and scripts to the viewport.

When content is rendered (either for viewports or the Confluence UI) every macro may mark web resources as required. These are collected and once the rendering is complete the whole batch of resources can be included as described below.

You may also include additional resources or whole context batches. This should only be necessary if a macro you are using isn't properly requiring the resources it actually needs.


CSS and Script Conflicts

Due to the web resources mechanism in Confluence the Javascript and CSS batches that are linked to in the generated tags should be considered standalone resources.

Therefore they most probably will apply as well to the static (non-content) HTML elements provided by your theme and will break your own styling. This is especially true if you built your theme on top of an AUI version that is distinct from the one provided by Confluence.

We invested great efforts to ensure that our new default theme - Scroll WebHelp - contains the required CSS scoping and reset information to keep that effect as minimal as possible.

We recommend that you apply similar scoping to your own theme before using the web resource placeholders. You can get the Scroll WebHelp theme here: https://bitbucket.org/K15t/scroll-webhelp-theme

Methods

Name

Type

Description

$webResources.css

String

Tags for all CSS resources.

$webResources.js

String

Tags for all JavaScript resources.

$webResources.meta

String

All HTML meta tags.

$webResources.require(completeModuleKey)

n/a

Ensures that specified resource is included when using $page.resources and related methods. The resource must be specified using the complete module key.

  • Parameter: completeModuleKey

  • Type: String

$webResources.requireForContext(context)

n/a

Ensures that the resources for the given context are included when using $page.resources and related methods.

  • Parameter: context

$webResources.toString()

String

All required resources, CSS and JavaScript. Also meta tags.


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.