L
L
lightalex2014-10-16 09:21:07
PHP
lightalex, 2014-10-16 09:21:07

How to make iframe links external?

Hello!
There is an iframe, there is a site on wp that is loaded there
How to make it so that when you click on a link, a redirect occurs not in the iframe itself, but on the page where the iframe is located?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
X
xmoonlight, 2014-10-16
@xmoonlight

on the parent (your site):
or from an iframe:

<a href="" onClick=javascript:opener.document.location.href='/page2/'>родительскую страницу на page2</a>

D
DjSebas, 2014-10-16
@DjSebas

Add to site in a frame in a block

<head>
...
<base target="_parent" />
...
</head>

Browser support : reference.sitepoint.com/html/base
var newBase = document.createElement('base');
newBase.target = '_parent';
window.frames[0].getElementsByTagName('head')[0].appendChild(newBase);

S
Sanes, 2014-10-16
@Sanes

target="_blank" ?

E
Evgeniy Samoilenko, 2014-10-16
@samoilenkoevgeniy

I would try getting all the iframe links and add http://domainname/link to the attributes.
But we need to see if it is possible to get all the links from it, and so on.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question