Hi Ulf,

Adding javascript this way to a page will not work. It will show
the javascript as text on your page.
You may want to check an older plugin (
https://www.ecyrd.com/JSPWiki/wiki/JSPluginScripts) who allows you to do
this, but not sure if this would still work.

Anyway, editing the page you've created should not cause any problems, with
or without preview.
I've created a small test page
https://jspwiki-wiki.apache.org/Wiki.jsp?page=TESTEST which seems to be ok.
(running 2.11.0-M5)
You may want to check the browser developer console  for any JS errors ?

BTW: you can turn off the edit preview with one of the dropdown menu's in
the edit toolbar : uncheck the LivePreview checkbox.


KR
    dirk

On Mon, Jun 22, 2020 at 5:01 PM Ulf Dittmer
<ulf.ditt...@googlemail.com.invalid> wrote:

> I'm trying to insert JavaScript into a wiki page, like this:
>
> [{If page='SandBox' exists='true'
>
> <script language="javascript">document.writeln("<b>User Agent: </b>" +
> navigator.userAgent);</script>}]
>
> (Yes, it's a gross hack, but I'm just playing a bit with what's possible,
> and sometimes it's nice to be able to inject arbitrary content into a
> page.)
>
> The page displays as I would expect, but if I try to edit it, the preview
> of the JavaScript bit takes over the entire screen, making editing
> impossible. You can see for a short moment that the edit screen is actually
> displayed correctly, before the preview is triggered.
>
> I got to this point by creating the page with 2.11M3 which IIRC didn't have
> the preview, but now I'm using 2.11M6.
>
> So I'm wondering a) Is this a bug that could be fixed?, and b) Is there a
> way to turn off the preview, ideally just for this page?
>
> Thanks!
>
> Ulf
>

Reply via email to