Ulf, Would it be possible to make a testpage on https://jspwiki-wiki.apache.org/ to reproduce the issue ? So I can check what js error it throws.
dirk On Tue, Jun 23, 2020 at 9:41 AM Ulf Dittmer <ulf.ditt...@googlemail.com.invalid> wrote: > Huh. Then there's a disconnect somewhere: As I said, this technique works > fine for me in M3 and M6. If I turn off the preview, I can edit the page > fine. There's indeed an error where it is trying to create the script > element during preview: > > [Error] NotFoundError: The object can not be found here. > removeChild (haddock.js:1:15374) > exec (haddock.js:1:15374) > success (haddock.js:1:89108) > (anonymous function) (haddock.js:1:17784) > onStateChange (haddock.js:1:84471) > (anonymous function) (haddock.js:1:17784) > (anonymous function) > > in this code in haddock.js: > > var r = e.createElement("script"); > r.setAttribute("type", "text/javascript"), r.text = n, > e.head.appendChild(r), e.head.removeChild(r) > > > Thanks for pointing me to JSPluginScripts > <https://www.ecyrd.com/JSPWiki/wiki/JSPluginScripts>; I'll check out what > it does. If it no longer works I can probably get it back into order. > > > On an unrelated note, Firefox warns of this: > > Cookie “JSPWikiUserPrefs” will be soon rejected because it has the > “sameSite” attribute set to “none” or an invalid value, without the > “secure” attribute. To know more about the “sameSite“ attribute, read > https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite > > Is that on someone's radar already, or should I open a JIRA ticket for it? > > > On Mon, Jun 22, 2020 at 9:59 PM Dirk Frederickx <dirk.frederi...@gmail.com > > > wrote: > > > 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 > > > > > >