...

View Full Version : retreving the pages name from a iframe



SalmanCSF
03-18-2004, 05:30 PM
Hi,

is it possible for me to get the main pages name from within a IFRAME?

If so, how and is it cross browser safe technique?

requestcode
03-18-2004, 07:26 PM
If it is in the same domain then I believe you could use parent.document.title to grab the title of the main page and parent.location.href to get the document. I have not tested this so I can't say for sure.

SalmanCSF
03-18-2004, 07:30 PM
i need it to work for same and different domain..not possible?

requestcode
03-18-2004, 08:36 PM
Due to security restrictions you cannot grab the info for a page that is in another domain.

SalmanCSF
03-18-2004, 11:55 PM
Would this be possible.

Domain#1 creates a javascript section on every page, and creates a variable that holds the name of the current page.


Then, in the IFRAME (from another domain possibly) it simply looks for that variable, if it exists, then use that since it contains the URL of the main page.

Is that a clean solution?

SalmanCSF
03-19-2004, 12:06 AM
How can I check if the parent page has a Varialbe created?

Thanks!

glenngv
03-19-2004, 05:28 AM
As has been said, you cannot grab data from another domain. You will get an access denied error.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum