![]() |
Start javascript on opening page - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: Start javascript on opening page (/thread-157.html) |
Start javascript on opening page - mrhappy - 05-08-2018 Hi, How can a javascript function (from a file) automatically be started when opening a webpage? I have already added the Javascript filename to Contentfiles and executed a function but got no result. Greetz RE: Start javascript on opening page - Alexandre Machado - 05-08-2018 Have you checked the browser console window for errors (F12 - dev tools - Console tab)? also, have you checked the network tab (in the same dev tools area) to see if your JavaScript file loaded correctly from server? About your question, you can execute it like this (This is one of the ways. Actually there are several different ways to accomplish the same thing): procedure TIWForm1.OnRender(Sender: TObject); var JS: string; begin JS := 'yourjsfunction("somestringparameter", 2, 20, "another string parameter");'; AddToInitProc(JS); end; RE: Start javascript on opening page - mrhappy - 05-10-2018 The Javascript has loaded correctly from the server. I didn't had the OnRender call so that is probably the cause. Thanks for the info. |