Access frames on different domain from Frameset
-
One page containg two frame....with help of SHDocVw.InternetExplorer object i have to excess second frame. Problem is that when try to loop through below code Dim HTMLDoc As mshtml.HTMLDocument HTMLDoc = oIE.Document For i As Integer = 0 To HTMLDoc.frames.length - 1 Dim f1 As mshtml.IHTMLWindow2 = CType(HTMLDoc.frames.item(i), mshtml.IHTMLWindow2) MessageBox.Show(f1.document.body.innerHTML) Next while access through second one it gives me that "Access is denied." after searching i come to know that this is happen dur to cross page scripting of frame.... here i have see that second frame point to different domain. is there any solution for this problem....??? thank you.
-
One page containg two frame....with help of SHDocVw.InternetExplorer object i have to excess second frame. Problem is that when try to loop through below code Dim HTMLDoc As mshtml.HTMLDocument HTMLDoc = oIE.Document For i As Integer = 0 To HTMLDoc.frames.length - 1 Dim f1 As mshtml.IHTMLWindow2 = CType(HTMLDoc.frames.item(i), mshtml.IHTMLWindow2) MessageBox.Show(f1.document.body.innerHTML) Next while access through second one it gives me that "Access is denied." after searching i come to know that this is happen dur to cross page scripting of frame.... here i have see that second frame point to different domain. is there any solution for this problem....??? thank you.
No. For security reasons, scripts cannot access other domains. You can try doing a similar code on the server side, that is, the .net (and not the browser script) would query the page and read the HTML for you. This can be achieved throught the System.Net.WebRequest class. After gathering all the HTML, you can just write it in a file or something.
Regards, Leonardo Muzzi