I asked this question a while ago and was surprised that nobody had an answer. I´ll try my luck again, this time with a slightly rephrased description of the problem. Hopefully somebody can point me in the right direction.
Many webpages position ads in IFRAMEs. Usually they display an image in the IFRAME. Left-clicking on it opens the linked page. Right-clicking allows either to save the image (Save Image as) or to view its properties. In the property window the full address of the image is revealed, for example:
MY QUESTION: IS IT POSSIBLE TO PROGRAMMATICALLY RETRIEVE THE SAME INFORMATION – THE ADDRESS OF THE IMAGE?
The source code of the webpage only contains an src to the document linked in the IFRAME but not the address of the image, for example:
nt=webde" width="640" height="70" scrolling="no" marginwidth="0" marginheight="0" frameborder="0">
Accessing the content of the document linked in the IFRAME is not possible because of cross frame security.
Here is an example site: http://freemail.web.de
The second element from the top is an IFRAME, containing five different ads.
I fooled around with this, without much success:
Private Sub setEvent(doc As HTMLDocument)
Dim sElement As IHTMLElement
Dim testforError As String
On Error Resume Next
' MsgBox "setEvent " & doc.location.href
For Each sElement In doc.All
testforError = sElement.tagName
If Err.Number = 0 Then
If .tagName = "IMG" Or .tagName = "A" Then ….
If sElement.tagName = "FRAME" Then ….
'This approach only provides the src to the document linked in the IFRAME
'How to get the address of the image displayed in the IFRAME? Obviously
'Internet Explorer knows how to get it, since it shows it in the property window
If sElement.tagName = "IFRAME" Then
For cnt = 0 To doc.All.length
If doc.All(cnt).sourceIndex = sElement.sourceIndex Then MsgBox doc.All(cnt).src
If Err.Number <> 0 Then
Thanks for your help!