Where does the function onLoad() in my Seaside generated html document come from, and how to get rid of it?

StackOverflow https://stackoverflow.com/questions/12932349

  •  07-07-2021
  •  | 
  •  

Question

Some (not all) of the html documents generated by Seaside have these elements in it:

<body onload="onLoad()">

<script type="text/javascript">/*<![CDATA[*/function onLoad(){};/*]]>*/</script>

I do not use any Javascript in these documents and i wonder, where this comes from, and if/how i can prevent these parts from being added.

Était-ce utile?

La solution

Seaside generates this markup in the class WADefaultScriptGenerator. Unfortunately the markup needs to be generated even if you don't use Javascript, as this is not know when Seaside opens the <body> tag.

You can customize (or avoid the Javascript markup generation) by subclassing WAScriptGenerator and setting your custom class in the application configuration. Either through the configuration interface or programmatically:

application := WAAdmin register: MyRootComponent asApplicationAt: 'myapp'.
application preferenceAt: #scriptGeneratorClass put: MyScriptGenerator.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top