capture top.location masking URL in PHP variable?

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

The site has a few landing pages that link to the same Drupal webform.

The landing pages are framed in masked URLs (and thus so is the webform).

Several masked URLs may display the same landing page/webform.

Need to capture the top window location (ie the masking URL).

HTTP_REFERER has the URL of the landing page, the referrer of the webform frame, not the top masking URL.

This could be accomplished by setting a cookie on the landing page and retrieving it on the webform... is there a simpler way?

Could a php session variable be used instead of a cookie? (must contain the top window location of the landing page and/or webform - same masking URL)

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Setting the cookie with javascript on the landing page, then reading it in the webform with php works - only when the landing page is not in the masking frame.

The masking is being set up through GoDaddy admin by the webmaster

Should we use .htaccess? how would that be done, to rewrite a url like http://domain/content/filename to the masking url http://someotherdomain/ ? could I then capture the someotherdomain in a cookie? or would it be accessible by REQUEST_URI or HTTP_HOST?

When it is framed in the masking URL I can access the top/parent window, alert(top) shows the object Window, but I cannot read the top.location (or parent.location, or window.parent.location, or self.parent.location or any location.toString() ...)

I think there is a cross-domain security issue in the javascript.

suggestions?

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Eureka!

setting the cookie to document.referrer captures the parent frame's URL!

YAY! Laughing out loud

They have: 1 posts

Joined: Jun 2009

Hi,

I also have the same issue. I have set up the URL Masking in GoDaddy
Can you help in understanding on how to set the cookie to document.referrer????

Regards
Raj

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.