How can I get an iframe such that when it loads up, it loads up with the page inside scrolled down by a fixed amount (say 100px)?
I have so far:
<iframe src="http://news.bbc.co.uk/1/hi/uk/7459669.stm" scrolling="no" width=500px height=500px></iframe>
but it loads up with the bbc.co.uk page inside at the top left when I actually want it to load up scrolled part way down (that is the page inside the iframe scrolled down, not the page containing the iframe).
Anyone know how to do this?
Its not exactly what you are looking for but you could set the URL to load scrolled to a particular element if you know that an element with that ID will always be on the page.
Something like this:
http://news.bbc.co.uk/2/hi/uk_news/7459669.stm#mediaAsset
HTH
You can not do this. Browser security restrictions will prevent you from accessing the "inside" of that frame completely. If the frame src was from the same domain as the containing page, then you could add an onload handler that set myiframe.contentDocument.body.scrollTop = 100;.
Genrally I Do Specify marginheight attribute on iframe for this
<iframe src='url' marginheight='100px'>
You can also use marginwidth attribute to move inner page left side
for more information checkout this link
http://www.w3schools.com/tags/tag_iframe.asp
I hope Thats Help
Related
I am trying to use Iframes and or PHP to hide a link that is dynamically created. The link is being created in php. But when I try to access that link from within an iframe it takes over the whole page. The site loads, but the idea is that if it was in an iframe the url could be hidden and the user could click multiple items with out having to enter all their form data in every time.
I've tried using the link as a header and using php commands like:
$remote = fopen( $URL, "r");fpassthru($remote);
where $URL was my link.
a sample of the link is:
http://fb-zc-0.cafe.zynga.com/current/iframe//mfs_sent.php?ids=2&tab_clicked=All&request_id=236973056431070&gid=3014&today=1&time=3&ref=gift_today&cafe_token=OAlF7gSlMbQxAtBhvnprTzNhIww8H7Aq2z9i3KJwGWmJzUQfxZ8b9/kFWMVqN62JUihQA06VtuuoKoxmosK6JIPKWTMl0oQecLb+0e0HSAk3S32f5BCI7xhYB9SflOnN&from_page=SUNRISE_BREAKFAST_1&kingdom=quest&phylum=baklava&uid=342&sendkey=8e4aa1a75594c47cc61aee301efff90e$$ccF(NUP,67jiH3QM7!nspE0W8d8KprzD5,Za77bp34G*S_ST)*ilx)F7Y)acC4xj971Kkswxx2OM3eij3z1h0M3eij3z1h0&mode=quest_asking&quest_key=SUNRISE_BREAKFAST_1&mfs_time=3&snood=1&ajax=true&limiter_channel=rsvp&limiter_type=build_a_carnival3+5
Any help would be appreciated.
If you have links outside of this iFrame and want them to load into that iFrame on the same page, you'll have to give it a name, then target the named iFrame within your link's href.
<iframe src="http://google.com" name="myframe" hieght="100" width="100"></iframe>
<br/>
Test.
However, if you're loading a page into your iFrame that's loading links with target="blank", then those will go to a new window; unless you don't have access to those pages, you won't be able to change the links (short of writing JS to dive into your iFrame, etc).
I have iframes on my website which point to content on a different domain. This content is meant to be re-purposed and is ad supported. There is 3-5 ad's on each page, each with their own close button. I believe they are all in one div, id="bannerfloat22". Is there a way to make a close button but target the div inside the frame? The codes I've tried only seem to work if the div is on MY page.
Example: I use this iframe on my page.
<iframe src="http://coolsport.tv/kiwi25.html" name="25" width="650" height="480"></iframe>
Thanks.
If the iframe url is a different domain, then no - there is nothing you can do. If the iframe url is from your site's domain, then yes - you can target the DOM inside the iframe.
In short... No. Javascript from one domain cannot have any control over a DOM from another. This is a security issue - eg to stop a hidden iframe stealing login details for another site
For more information, read up on the same origin policy
I am using an iframe under which another small application is running on. In one certain page of the iframe, I try to redirect the url to parent's index page. But if I am using header('location:fullpath/index.php'). then it is redirecting to the mentioned page, but within the iframe. I need it will be opened beyond the iframe. Could you please help me to fix up this issue?
If you don't want to use javascript and you have control over the target page, you can put this metatag at the top of the target page and it should open in a new window.
<META HTTP-EQUIV="Window-target" CONTENT="_blank">
Here is a list of the other CONTENT options you can try as I'm not certain what beyond the iframe means.
Same Frame -_self
Whole Page -_top
New Window -_blank
Parent Frame-_parent
I am displaying the iframe in wordpress page template. In iframe src i have pased the external site url. The Problem is that i am not able to to hide the logout link in the iframe.
I have tried the below mention code :-
frame = document.getElementById("toolkit-iframe");
frame.document.getElementById("top-nav-links").style.display='none';
OR
frame = document.getElementById("toolkit-iframe");
frame.contentDocument.getElementById("top-nav-links").style.display='none';
I have not got any success to hide the link of logout. Can anybody can help me. i will be verymuch thankfull.
There is no direct way to manipulate the content of an iframe, that's not hosted on your domain due to security issues.
However, there is a "hacky" workaround for your problem:
Place your iframe in a container div. Div gets relative positioning. Place another div in the container and set it to absolute positioning and perhaps a positive z-index. Set width and height and position of this hiding div according to the logoutlink size and position.
You can not inject javascript into a page from another domain, even within an iframe.
In my page i have iframe code. When i click particluar link that i frame window enabled.it is a form.when i submit the form i get some hidden field values.how can i access those values in my parent page?.
Since your iframe src= a complete url, and not a relative path (i.e: /app/appsignup.jsp) I am going to assume this Iframe exists at another IP or domain than the original page. If this assumption is correct, then you are not going to be able to modify the Iframe's DOM due to cross site scripting security rules in most browsers.
If the parent site, and child iframe exist on the same top level domain, then you can use document.getElementById("iframe_id")
Edit to answer second question:
You can add an onLoad event to the iframe, and so long as the iframe only has 1 form, and the page only changes when submitted, and this is where you want to be redirected.
Here is an example, but know this will redirect the first time and not work!
What you will want to do is put a function in there, and then in the .js for that function check for the second onLoad...
<iframe name="signUp" id="signup" src="10.80.32.9:8080/app/appsignup.jsp"; width="650" height="500" onLoad="window.location('/index.html');">
You will not be able to access the iframe if it's on a different domain and/or port, as yours seem to be. The Same Origin Policy will prevent that.
There may be a workaround, depending on your use case. Maybe add some more details.