cakephp - cant redirect outside an iframe with cakephp3 -
i have application need redirect website ( example below). issue cakephp3 application embedded in wordpress iframe , reason below command executes inside iframe have webpage within webpage. how can redirect webpage outside iframe?
//controller if .... return $this->redirect('http://www.xxxxxx/thank-you-application/');
- what goes on in vegas, stays in vegas
- what goes on in iframe, stays in iframe
i don't think want possible php (and php framework), maybe getting content of page want load inside iframe with:
$http = new client(); $response = $http->get('http://example.com'); $content = $response->body();
and put $content in view in "top level page / mean not inside iframe" (like in financial website), i'm not sure of exact way.
the easiest solution send in controller value ($redirect = true) view say: "hey! view, plz open link top level window! / mean outside iframe".
write in view (or template):
<!-- ... --> <?php if($redirect) : ?> <body onload="javascript:window.top.location.href='<?= $this->url->build([ "controller" => "pages", "action" => "display", "thank-you" ]) ?>'";> <?php else: ?> <body> <?php endif; ?> <!-- ... -->
hope helps
Comments
Post a Comment