How to Load IFrame after PageLoad - iframe

I have one page .aspx, and in page , I have put an iframe on header page.
Is it possible that iframe loads after page load finishes?

You can leave the src of the iframe empty then use Javascript to change the src when the document loads.
<body onload="function_to_change_iframe_src()">
<iframe src=""></iframe>
</body>

Related

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.

iFrame source can not be retrieved

<iframe id="myFrame" runat="server" name="main" width="100%" src="http://www.somewebpage.com/" />
This is simple iFrame I put on my webpage. After I click on couple of buttons on that website, iframe source remains the same. But I want to be able to retrieve the changed source every time I click on buttons, links etc...
How can I achieve this?
Edit: This is the screenshot of my work. When I click on "Git" button, webpage loads on the iFrame. However, when I surf on the website, I want textbox to be updated to the source of the iFrame.
Ok, here is an idea that I test it now and its work. You change the input box after the iframe loads using the onload event of the iframe
<script>
function HasChange(me)
{
document.getElementById("WhereIamId").value =
document.getElementById("WhatIShowID").src;
return false;
}
</script>
and the html
<input type="text" id="WhereIamId" value="" />
<iframe src="page1.aspx" onload="return HasChange(this);" id="WhatIShowID" ></iframe>
You can use also the document.getElementById("<%=myFrame.ClientID>") to get the rendered id. After your iframe loads you update the text box with the current url.

iframe refresh banner code NO PAGE REFRESH

how do i create a iframe refresh ads banner code NO PAGE REFRESH ,not adsense
example =>
<div align="center">
<iframe src ="http://www.1pars.com/ads/2.html" id="I1"
name="I1" align="center" height="63" width="500" "border="0"
frameborder="0" scrolling="no" marginheight="1"
marginwidth="1"><p>Your browser does not support
iframes.</p>
It's simple as this:
<iframe src="../../../index.htm">
<p>Your browser doesn't support frames. You can visit the site directly via
this link.</p>
</iframe>
The linked index.html needs to have this in its header:
<meta http-equiv="refresh" content="15; URL=index.html">
The question is fairly generic; however, if you want to just have an iframe load a banner image, and then have that banner image refresh dynamically, the best choice to me would be an ajax request to the server to fetch your next image to use, and then insert the new source url into your image tag on the page.
Alternatively, your iframe banner page could contain some images on it, and some javascript to rotate between the predefined images.
However, without knowing a more complete issue, that's the best answer I can give.

Redirect to another page outside of IFrame

I have asp.net page and I have an Iframe inside of the page. In the page that I have inside of the IFrame, I have a link button and the link button will redirect to another page.
Is there a way I could redirect to another page outside of the IFrame (Redirect from the parent page instead of inside of the IFrame) ?
Thanks.
Can you modify the "form" to look like below:
<form target="_top" id="form1" action="search.aspx" method="post" name="form1">

iframe refreshes main page

I am currently using a iframe on my main web page. When i click on a link in the iframe I would like it to display the content on the main web page. Any thoughts?
Set the target="_parent" on the link.
Another way would be to put this into the page that represents the content of the IFRAME:
<base target="_parent" />
I haven't worked with iframes in ages, but I believe it's just <a href="myLink.html" target="_parent" />
use target='_top' on the link in your iframe
<a href='http://example.com' target='_top'>My Link</a>
This will result in the full window/tab of the browser being replaced with the content of the link. You could also use _parent as the value of the target attribute. That would result in the immediate parent of the iframe being replaced which may be what you want. It's possible though for iframes to be nested, so if a.html contains b.html, which contains c.html, a _top link in c.html would replace the entire page (a.html), but a target of _parent would only replace b.html.

Resources