0

I have a webpage with this code:

<object data=http://<?php echo $_GET['wp'];?> width="600" height="400"> <embed src=http://<?php echo $_GET['wp'];?> width="600" height="400"> </embed> Error: Embedded data could not be displayed. </object>

I'd like to know if the user through navigation manages to get to a specific site within the

<object>.

Is that possible?

If not, is there another way to embed a webpage within a website that allows me to know in which webpage he is in?

EDIT: What if we know some of the context of the source code the target page has and we just need to see if the page within the page contains this part of the code, is this possible?

Ant
  • 1,083
  • 1
  • 15
  • 35

1 Answers1

1

You could use an iframe!

var url =
   document.getElementById('my-iframe').src;

Edit: As Ant mentioned, you can't get the url from an iframe tag unless domain of the page in the iframe matches the page containing the iframe.

ClosureCowboy
  • 20,825
  • 13
  • 57
  • 71
  • good idea, but I need a little more help... I changed the code into: `` and tried this: `` ... `
    ` but when I click on the button nothing happens
    – Ant Dec 04 '10 at 04:58
  • You need to add the `id` attribute to the ` – ClosureCowboy Dec 04 '10 at 05:19
  • I just found this question, which seems to provide the answer: http://stackoverflow.com/questions/44359/how-do-i-get-the-current-location-of-an-iframe – ClosureCowboy Dec 04 '10 at 05:31
  • so, it seems it is not possible except if the user navigates within the same domain the ` – Ant Dec 04 '10 at 05:38