Hi!
I found that
Window
supports such a very nice feature as
executeJavaScript(‘…’)
. Very cool to init something etc on a document load. Well, it works, as long as an event fired (e.g. user clicks something) or at init first time. But when user reloads a web-browser, of course, init() no more called and things that should be loaded on document load — skipped. So the only way I found so far is to trigger
getWindow()
which I override and executing JavaScript there.
But the problem is, that
getWindow(…)
is called exactly as twice per each reload. That is, if I output something to the canvas, it gets there twice. I thought I can workaround that with a random ID’s and find dupes. Unlikely, it won’t work, because getWindow(…) will trigger freshly new call to the JavaScript.
Hence, mea culpa, is there a proper way to execute some javascript on document load once?
P.S. Everything is happening as Portlet 2.0 on Liferay.