Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make links in an iframe relative to the parent URL

I want relative links inside an iframe to be relative to the URL in the address bar, not relative to the iframe's URL. Is this possible?

Modern browser support is all I need.

As an example: Address bar in browser shows http://www.example.com/a/b.html. Inside that webpage is an iframe with a src of http://othersite.com/12x982h/index.html. Within that html, there's a link to test.html. When you click on that link, the browser should load a new page at http://www.example.com/a/test.html.

UPDATE: I don't have control over the iframe's content.

like image 244
at. Avatar asked Oct 15 '13 10:10

at.


Video Answer


1 Answers

I assume you have control over the iframes content. If my assumptions is correct then that means you can set a "base path" using the <base> tag. All relative URLs will then be "based" on the path you define therein.

like image 121
Gung Foo Avatar answered Sep 22 '22 16:09

Gung Foo