Detect IFrame URL Change - fire off Event?

yas022100 used Ask the Experts™
I have an IFrame that I am showing "List of Items" page (ListOfItems.htm).
Within this HTML page, there are several links that a user can click to drill down to a specific item.  The name of each item page is same as item number (such as A.htm, B.htm, C.htm)

What I am trying to figure out is... whenever user clicks on an item from "ListOfItems.htm" page, I need to fire out some event that notfies me that user has clicked on a specific Item

The problem is I cannot modify "ListOfItems.htm" page nor Each Item Number pages.

I know this can easily be done by adding client script for either ListOfItems.htm page or onload event for each item page.

HOWEVER, I cannot modify and add javascript to those pages.

I also cannot find out AFTER THE FACT, what the URL for IFrame is.. This event has to happen when user clicks.
Is there any event that I can use for IFrame that tells me that user clicked on an item, and here is the page name for that.

This seems impossible, but there may be an answer
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
How about this --

Do an XMLHTTP scrape on the ListOfItems page... then output the scraped HTML and add a client-side function that alerts you on click...
Put this page into your IFrame:

<%@ Language = VBScript %>

Response.Buffer = True
Dim objXMLHTTP, xml

' Create an xmlhttp object:
Set xml = Server.CreateObject("Microsoft.XMLHTTP")

' Or, for version 3.0 of XMLHTTP, use:
' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")

' Opens the connection to the remote server.
xml.Open "GET", "", False

Response.Write xml.responseText
Set xml = Nothing

    //Client-side stuff goes here


Hmm.. That is VERY interesting approach... I will look into this and get back with you.. It has additional twist to how user gets to ListOfItems.htm page so will see if this will work or not.

OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.


OK.. I got to where I can get the contents of List of Items.. Now how do I detect when user clicks?
I can use onUnload, but how do I know which page user is going to???


Well, I figured out.. the ListOfItems.htm page contained bunch of Anchor <A Href=""> stuff, so I replaced that with <A Href="#" onclick=""> thing then call my client script that I created, then now I can find where user is going!

THANX BUNCH for helping out with this!

Glad to have helped. Thanx for the grade.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial