Principally and first of all:
1) you can't test for or invoke a function before the Object is rendered on the page, so you will have to interact With the Control after the page is drawn in the browser (See jquery document.ready() for example)
2) It sounds very, very strange to put a webbrowser Control onto a web page
If it is in a winforms Application, you have the following option:
Link to info
or this to bring you further (since the question was very vague:
More info