W3C home > Mailing lists > Public > public-html@w3.org > May 2013

Re: make links within an iframe replace the parent document

From: Robin Berjon <robin@w3.org>
Date: Tue, 21 May 2013 16:18:19 +0200
Message-ID: <519B822B.5050707@w3.org>
To: "Constantine A. Murenin" <mureninc@gmail.com>
CC: public-html@w3.org
Hi Constantine,

On 17/05/2013 18:08 , Constantine A. Murenin wrote:
> I'm designing a deterministic URL shortener system in nginx, now using
> HTML5 and iframes, and I got stuck with not being able to specify that
> all links within the iframe on my site, have to be opened up replacing
> my site.  (Obviously with the domain of the problem -- URL shortening
> -- I generally have no control over the URLs that are loaded within
> the iframe.)
> I've tried using <base target="_top">, and also a target="_parent" on
> the iframe (which is not legal in HTML5, BTW), but to no avail.

Those wouldn't work. There is no target attribute on iframe, and the 
<base> element only applies to the current document (which makes sense, 
otherwise you'd likely shoot yourself in the foot, and definitely create 
same-origin violations in iframes).

As far as I know, your problem is an unsolved one. I don't even think 
that you can solve this with JS because you won't have access to the 
location of what's inside the iframe after navigation if it's not a 
same-origin page.

Given today's technology, I think that the best you can do is to have a 
"Remove the frame" button on your page that loads the iframe at the top. 
I'm well aware that this does not help in the case where one of your 
users has already navigated inside the iframe as, unless I'm mistaken, 
it will return them to the first page that the iframe loaded.

Could you please file at bug at the link below? I reckon that this is a 
legit use case, though one would have to be careful that the solution 
not create SOP issues.



PS: you were wondering about the "silence" in response to your post. You 
posted Friday evening (at least in my TZ) and Monday was a bank holiday 
in quite a few countries. Some of us do other things over the week-ends :)

Robin Berjon - http://berjon.com/ - @robinberjon
Received on Tuesday, 21 May 2013 14:18:32 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:46:02 UTC