简体   繁体   中英

Redirect webpage to link in Iframe

Currently, I am creating a webpage which use search tool of Google.com. - I made a form on the page which will sent query form to Google.com. - For the search result, I used I an iframe to display those content.

But the problem is: when the iframe displays search result links, If user click on those link, only the content in the iframe got redirect to the result webpage, while I want the link to redirect the main page itself.

Is there a solution for this ?

The code for my main page - The searchFrame is where the form is - The contentFrame is just an empty page.

'

    <div id="sidecontainer">
<iframe id="SFrame" name="SearchFrame" frameborder ="0" width="500" height="100" scrolling="no" src="SearchBox.html"></iframe>
</div>

<div id="content">
<iframe id="CFrame" name="ContentFrame" frameborder="0" width="80%" height="900px" scrolling="no" OnLoad="window.scroll(0, 0);" src="ContentFrame.html"></iframe>
</div>

'

Cheers

Use base tag. Add this to the head of the iframe. This will open all the links in the parent page itself

<base target="_parent" />

This is supported in all browsers too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM