How to give control back to the browser from javascript
Posted: Fri Apr 01, 2011 7:03 am
Hi,
When I am trying to inject below javascript in to IE browser.
Since the page is not completly loded, script could not able to find the text field that it has to set and throwing an error: "Internet Explorer Script Error"
I have tried "setTimeout" function, however the problem is: Browser taking the control back after the whole script is getting executed and then page is getting navigated to the page "http://www.google.com"
Here I want to execute the Step1 and then give control back to the browser from my javascript file so that browser loads the page completely and then I want to take back the control then execute the Step2.
Please guide me!!
Thanks!!
When I am trying to inject below javascript in to IE browser.
Javascript engine executing the first step and then before the page getting navigated to "http://www.google.com", it is trying to execute the next step.Step1: window.location = "http://www.google.com"
Step2: document.getElementsByName("q")[0].value="Script Value"
Since the page is not completly loded, script could not able to find the text field that it has to set and throwing an error: "Internet Explorer Script Error"
I have tried "setTimeout" function, however the problem is: Browser taking the control back after the whole script is getting executed and then page is getting navigated to the page "http://www.google.com"
Here I want to execute the Step1 and then give control back to the browser from my javascript file so that browser loads the page completely and then I want to take back the control then execute the Step2.
Please guide me!!
Thanks!!