iframe location.hash #top not working in ie8 - javascript

i am having this problem for a week couldn't figureout kindly help!
1.I have a dynamic news page.
2.below the news a comments page attached with an iframe.
3.comments page is having pagenation.
when user navigate trough pages in iframe parent page should scroll to iframes top for that i have used #top in iframe links its working in all browsers except in IE8 (i didn't check in other versions of ie though), so please help me out with it.
thanks,
eeswar

In the outer page, define a scroller function:
<script type="text/javascript"> function gotop() {scroll(0,0);} </script>
Then when you define the iframe, set an onload handler (which fires each time the iframe source loads i.e. whenever you navigate to a new page in the iframe)
<iframe id="myframe" onload="try { gotop() } catch (e) {}"
src="http://yourframesource" width="100%" height="999" scrolling="auto"
marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" >
</iframe>
The nice thing about this approach is it means you do not need to make any changes to the pages included in the iframe (and the iframe contents can happily be in another domain - no cross-site scripting issues).

Related

How do I disable an iframe from scrolling by editing the referenced page?

Is there a way to disable the scrollwheel for a page that's being referenced by an iframe?
I'm trying to use an iframe to reference a site that I've made, but changing the iframe's scrolling attribute to no doesn't disable the scrollwheel.
Is there some css I can use in referenced page so that an iframe that references it won't have a scroll wheel?
Add scrolling="no" in iframe
<iframe src="https://stackoverflow.com/" scrolling="no" width="300px" height="500px"></iframe>

Prevent iframe js from auto scrolling the parent page

We have a page that has a video on it, embedded with an iframe.
The iframe js code for the player has the following code in it:
m.default.focus(function (e) {
var t = e.playButton;
(0, y.focusElement) (t)
})
This basically makes the play button visible on the screen if it isn't already. Which is fine for stand alone videos, but not on a page where we have the video embedded.
What it does framed in on our page is cause the entire page to scroll to that content.
We'd like to prevent that if possible.
Here is the iframe code:
<div class="embed-responsive mb-5 embed-responsive-16by9" id="myFrame" style="height: auto;">
<iframe allowfullscreen="" class="embed-responsive-item" sandbox="allow-scripts allow-downloads-without-user-activation allow-same-origin" src="https://sourcefile.onthesamedomain.com" title="Video"></iframe>
</div>
We've tried the scroll to 0,0 on the parent but that didn't work.
Apologies, but I forgot to add that this is only an issue in Firefox. The other browsers work with the attributes on the iframe.
Any help would be appreciated.
The 3rd party owner of the js within the iframe ended up providing a fix. There was no way we could do this without the screen scrolling back and forth.

Blocked iframe work-around

I have the following iframe:
<iframe src="https://www.weddingwire.com/morgancamille" style="border:0px #FFFFFF none;" name="weddingwirersvp" scrolling="no" frameborder="0" marginheight="0px" marginwidth="0px" height="600px" width="600px"></iframe>
... and it would appear that the website who's form I would like to display elsewhere has some iframe-specific parameters to deter people from displaying the form on other sites. Any ideas on how to get around this?
Changing the document to that particular iframe may help. Otherwise, you are running up against the intended purpose of iframes. You say you want to display elsewhere, but the purpose of an iframe is to prevent it from being displayed elsewhere.
jQuery/JavaScript: accessing contents of an iframe May be helpful here.

Sometimes images are not loaded in Iframe

I am using an Iframe to load an external page. The page has an image which sometimes loads but most time does not (worse in IE10 and 11). If the url is loaded directly into the browser without an Iframe it always loads, but not with the Iframe. Our application has an Iframe portlet that will call such an HTML file or one with a redirect. We cannot load the url directly into our Iframe because Dojo has a problem with the url parameter which is not valid encoding. The url creates a new image file every time it is executed and those are deleted at some point. Is this a known issue with Iframes? Is there a workaround without JQuery?
<html>
<title></title>
<head>
</head>
<body>
<iframe id="myFrame" name="myFrame"
src="http://www.gomeznetworks.com/charting/publicForm.asp?crypt=%7F%B3%AC%B2%C8%B2%96%C6%C1sc%7D%7Fj%85qe%B4%A3%9C%AB%B4%8E%9C%8Fe%90Tzc%96%8Fp"
height="99%"
width="100%"
marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0"
>
</iframe>
</body>
</html>
The problem was that an Iframe is apparently dealt with by the browser security in the same way as an external link. These links made use of cookies. Browsers set to block cookies had the problem. Once we allowed cookies for this site the problem was fixed.

is it possible a link from iframe to affect the mother page/main page where iframe is displayed?

I have a iframe that is included in another page (mother page).
<iframe name="commentsiframe" id="commentsiframe" onLoad="autoResize('commentsiframe');" width="100%" src="iframe.php" scrolling="no" marginheight="0" frameborder="0" ></iframe>
What if i have a
go top
in the iframe page. And when i click on it i want to manipulate the main page/mother page and make it go on top.
I have no ideea if it is possible, but i assume if yes it must be javascript!
Try using target="_top" or target="_parent" as attribute in the a-tag. Check out here
If the domain of the iframe and mother page are the same , then its easy
Use:
window.parent.scrollTo(0,0); //you can call any global function of the mother page
if the domain's are different , then its a bit difficult :
Refer to this question :
Cross domain iframe issue

Categories

Resources