ravinukala
Posts: 103
Joined: 2012-10-05
|
Hi,
I have developed IE bar where I am injecting some script in page in IEModule_DocumentComplete2 event
like this
private void IEModule_DocumentComplete2(object pDisp, string url, bool rootDocLoaded)
{
if (rootDocLoaded)
{
oRIEBar.DocumentCompleted(url);
}
}
Problem is, I am getting rootDocLoaded false when I refresh the browser.
Please help.
Regards |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Ravi,
What do you get in the 'url' parameter? Probably the browser refreshes iframes only. |
|
ravinukala
Posts: 103
Joined: 2012-10-05
|
Hi,
Yes, the browser refreshes iframes only. Now how can I come to now that all iframes/frames are loaded completely.
All my functionality is working fine for first load. It gives access denied error when user refreshes the browser.
Regards |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Ravi,
Now how can I come to now that all iframes/frames are loaded completely.
When the document is completely loaded, the 'ReadyState' property of the browser returns 'READYSTATE_COMPLETE'.
It gives access denied error when user refreshes the browser.
The fact is that the 'pDisp' parameter may return the iframe document. In this case you need to use the 'HTMLDocument' property to access the HTML DOM when you inject the script. |
|
ravinukala
Posts: 103
Joined: 2012-10-05
|
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Ravi,
Here is the solution for this web page:
private Timer timer = new Timer();
private void IEModule_OnConnect(object sender, int threadId)
{
timer.Interval = 300;
timer.Tick += new EventHandler(timer_Tick);
}
void timer_Tick(object sender, EventArgs e)
{
if (IEApp.ReadyState == IE.tagREADYSTATE.READYSTATE_COMPLETE)
{
timer.Enabled = false;
InjectScript(IEApp);
}
}
private void IEModule_DocumentComplete2(object pDisp, string url, bool rootDocLoaded)
{
if (rootDocLoaded)
{
if (pDisp is IE.WebBrowser)
InjectScript((IE.WebBrowser)pDisp);
}
}
private void IEModule_OnBeforeRefresh(object sender, ADXIEBeforeRefreshEventArgs e)
{
timer.Enabled = true;
}
private void InjectScript(IE.WebBrowser browser)
{
Debug.WriteLine("InjectScript: " + browser.LocationURL);
}
To activate the 'OnBeforeRefresh' event you need to set the 'HandleDocumentUICommands' property of the iemodule to true. |
|