Hi!
I am building a very simple plugin that needs to attach (or render) a javascript into the page.
The plugin is complete and it's working fine on the desktop version, anyway I am facing a very odd issue with the mobile layout. The script is rendered correctly but is not executed at all!
I am using the default theme with no modifications.
Basically I am adding a script form the init.php,
just to simplifly the debug I used a naive alert box:
OW::getDocument()->addOnloadScript(" window.onload = function() { alert('ok'); }",1);
which renders
(function(_scope) { window.onload = function() { alert('ok'); }})({});
I can see the "ok" alert box on desktop devices but looks like the
code is not executed on the mobile version (of course I checked, the code is into the html page).
also tried
- static external script using OW::getDocument()->addScript
- appendBody with direct <script></script> injection
...same outcome, code is correctly rendered into the page but not running.
Am I missing something?! Maybe I should to use "OW.bind(...) " or something similar?
Thanks in advance,
Andrea