0

I have an iframe at domain2 embedded in a main frame at domain1 that changes its location to a php file at domain1 and tries to send a variable through a url.

location change=http://www.domain1.com/phpfolder/publish.php?which=wikipedia. I'm trying to send the variable "which" with the url. In the publish.php file it receives the variable called "which"

$whichg=$_GET["which"]; 
echo "whichg=".$whichg;

if the domains are the same in the iframe and the main frame the variable comes through as expected. If the domains are different in the iframe and the main frame the variable does not come through. I don't get any javascript errors in either case.

Also if I just paste the domain into the browser url it works fine and the php file receives the "which" variable.

Is there a way to send the "which" variable through a url from an iframe at one domain to a php file in another domain?

Edit: Some more info about the request from the net tab in console

Request URL:    http://www.domain1.com/phpfolder/publish.php
Request Method:     GET
Status Code:    HTTP/1.1 200 OK

The iframe at domain2 I was talking about is actually a fancybox does that make any difference?

3
  • its possible the remote site is detecting your not legit, and is redirecting you
    – user557846
    Jun 11, 2014 at 23:05
  • Watch the network tab in the console to see what the actual url being loaded is.
    – xd6_
    Jun 11, 2014 at 23:06
  • The iframe in domain2 is actually a fancybox. Does that change anything? I posted the network info.
    – techdog
    Jun 12, 2014 at 0:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.