So i'm submiting form with jquery to ifram like this $('.form').submit() here is my iframe and form html
<form id="upload_image_form" src="#" target="iframeTarget" method="post" enctype="multipart/form-data"></form>
<iframe class="iframe" src="<?=url::base()?>user/upload_image/" name="iframeTarget"></iframe>
So when i load page i get my iframe load right page but when i submit my form iframe for some reason loads the same page i'm on not the user/upload_image why is this happening, maybe my form or iframe is incorrect?
You have to set your form action attribute to user/upload_image.
Does the iframe id need to also be set to "iframeTarget"?
And i think Dmitry is right, you need an action to post back to. Don't src is needed.
Related
I have adserver running on my server, i've created HTML clickable banner and it needs href target link to redirect somewhere.
The problem is that iframe link is dynamic and may change any time. What I want is to get href from iframe and redirect to it.
<img src="http://example.com/banners/front.jpg" style="width:728px; height:90px ; position: absolute; z-index:2;opacity: 0.0">
below code is given from company and displays banner itself
<script type="text/javascript">document.write("<iframe name='banner' src='https://target.com/scripts/banner.php?a_aid=586b827a9f74f&a_bid=a6c90d0d&w=1&refx2s6d="+encodeURIComponent(encodeURIComponent(document.URL))+"' framespacing='0' frameborder='no' scrolling='no' width='728' height='90' allowtransparency='true'><a href='https://target.com/scripts/click.php?a_aid=586b827a9f74f&a_bid=a6c90d0d' target='_top'>728x90 (GIF)</a></iframe>");
</script>
<noscript>
<h2>728x90 (GIF)</h2>
</noscript>
Provided code is one html code, not separate ones.
Also note that this is not clear iframe. It is script that contains iframe itself.
So I have made clickable html and can make redirection on click. But how to get href from iframe that gave me company?
I have an <iframe> loaded using a srcdoc attribute, not from src. I want to click the button using Watir-WebDriver, but I can't figure out how to locate the button, even in an <iframe> with an id attribute.
Is it possible to locate elements in an <iframe> loaded from srcdoc?
<html>
<body>
<div id="iphone">
<iframe id='ip1' srcdoc="<%= Nokogiri::HTML(my html code)%>"></iframe>
</div>
</body>
</html>
If the button you are attempting to click is within an iframe, you will need to make WebDriver switch focus to that iframe first.
This is because the content within an iframe is not visible to WebDriver unless it is currently focused on that iframe.
hello friends i am having two frames, each frame has a html form which should redirect to other page, but here the problem is when any of the page is redirecting the target page is seen only in that particular frame only....
when any of the frame's form is submitted how to redirect completely into the whole page...
i am using
<frameset cols="40%,60%">
<frame src="pmode.html" frameborder="0">
<frame src="create.html"frameborder="0">
</frameset>
For this purpose we have the target attribute of the form:
<form action="newpage.html" target="_top">
This means: "the target of this form is the top most page, not the current frame".
You can also try... <form action="newpage.html" target="_blank">
if you wish to open page in new tab
Jus put target="_blank" in the button link of the other page (pmode.html or create.html)
index.html is :
<iframe src="/changeDataAndBack"></iframe>
but the html file return back is show in the iframe ,
how to show page on the parent of the iframe
thanks
updated:
i changeed to this,but nothing happend :
<iframe src="/_openid/login?continue=/" target="_top"></iframe>
Targets apply to links, not frames.
<a href="..." target="_top">
If you want to redirect, do it server side.
it is ok now ,i add target="_parent" to iframe page :
<form class="openid" method="post" action="{{login_url}}" target="_parent">
I have a page that contains an iframe element. I want to have some text on the main page when clicked to change the iframe source. I can do that with an "a href" tag but the main page resets to the top instead of where the user was last on the page vertically. If I use an input type=button element, then it works just fine without resetting to the top of the main page. However, I want the look of just text on the page (with an underline) instead of a button look. How can I do this?
use target
Go to page 2
<iframe src="page1.html" frameborder="0" name="test"></iframe>
you can use a div or span (actually pretty much any element) instead of a button
<div onclick="iframe.src='new.html'" class="lookcool">sometext</a>
Not sure what you have done so far, but it seems like you want to change the page displayed in an iframe. To do that with a link, you can use target or javascript:
Target:
link
<iframe name="iframe" src="http://www.example.com" />
Javascript:
link
<iframe id="iframe" src="http://www.example.com" />