DebbieM
01-07-2009, 12:03 PM
Hi, I am sure this is going to be a one line fix, but I just cannot figure it out.
The plan is to have a set of pages which people (our partners) load into their own websites via an iFrame. I want to be able to find out which iFrame loaded my page so that I can use the relevant stylesheet / partner commission code for the duration of a visitors session. I do not have access to the page where the iFrame tag is placed but I can insist that they use IDs issued by ourselves.
My idea was to read out the ID from the iFrame tag that calls our pages and then go from there.
I have been trying out various options of getElementsBy, for example
parent.document.getElementsByTagName("iframe")[0].id
but whatever I try with getElementsByxxx only seems to work if I am already in the page containing the iFrame tags. As soon as I try the same code in the child page, I just get zero response.
Does anyone have any tips for me?
Many thanks
The plan is to have a set of pages which people (our partners) load into their own websites via an iFrame. I want to be able to find out which iFrame loaded my page so that I can use the relevant stylesheet / partner commission code for the duration of a visitors session. I do not have access to the page where the iFrame tag is placed but I can insist that they use IDs issued by ourselves.
My idea was to read out the ID from the iFrame tag that calls our pages and then go from there.
I have been trying out various options of getElementsBy, for example
parent.document.getElementsByTagName("iframe")[0].id
but whatever I try with getElementsByxxx only seems to work if I am already in the page containing the iFrame tags. As soon as I try the same code in the child page, I just get zero response.
Does anyone have any tips for me?
Many thanks