How to remove onclick popup from an iFrame player? - iframe

How to remove onclick popup from an iFrame embed player (Example below).
The player load media from different server, when click to play it shows too many popup ads.<iframe src="https://autoembed.to/movie/tmdb/299534" width="100%" height="100%" frameborder="0" allowfullscreen></iframe>
I have tried sandbox attribute in iFrame but they are not letting play the video, showing "sandbox attribute not allowed".

Related

Page jumps to top when iframe is clicked

My page jumps to the top when I embed this gdrive iframe, once you click on the iframe:
<iframe height="400px" frameborder="0" width="600px" src="https://docs.google.com/document/d/1u9NFjTPBd-9mucQUPvkqLP84iV6uaEcJNF5vQdHmYh8/edit?usp=sharing&rm=embedded"></iframe>
JSFiddle: https://jsfiddle.net/0qpe53os/
Question: Why does it do so and how can I prevent it from doing so?
I tried to preventDefault without any luck. Thanks a lot in advance for your help.
I'm not sure if this is useful. By the way you could use the onload attribute to scroll the page down:
onload="scroll(0,screen.height);"
<iframe height="400px" frameborder="0" width="600px" src="https://docs.google.com/document/d/1u9NFjTPBd-9mucQUPvkqLP84iV6uaEcJNF5vQdHmYh8/edit?usp=sharing&rm=embedded" onload="scroll(0,screen.height);"></iframe>
From my investigation, its not caused by the iframe itself. Its cause by the javascript executed by the embedded google docs. When the editing area of the google docs receives the focus this happens. If you access the menu area nothing happens unless it results something being added to the editing area. I tried restricting the iframe with sandbox attribute and this behavior no more happens, but of course you cannot use the google docs.
Sorry no solutions to suggest.
You could use javascript to check if the iframe is the active element and jump back to it if it is active.
if(document.activeElement.tagName == 'IFRAME') {
document.activeElement.scrollIntoView()
}
See this Jsfiddle for a working example.

How to make a button link within the iFrame load to a parent window?

Website Link: http://www.londonuw.com/category.aspx?id=MISC15
Under other products, click workers comp. You can see the page loads within the frame.
Here is the iframe code:
<iframe src="mywebsitelink" width="1000px" height="1550px" frameborder="0" scrolling="no"></iframe>
What do I add to make this load in the parent window instead of the iFrame?
In the i frame link add <a href="" target=_parent>.
The would open the page in parent and not in the iframe.
Found out what needed to be done. I inspected stackoverflow's post of iFrames.
http://www.w3schools.com/html/html_iframe.asp
When clicking on links in the center page, it will open a new window. But when i clicked on the dark bold menu items on the left it loaded in the parent window without needing to open a new page. Exactly what I needed!
Inspecting that element showed this code:
(a target="_top" href="default.asp" class="menu_default">HTML HOME
So all I did was replace "default.asp" with my website link and HTML HOME with my desired button name and magic!
**base target="_parent" or target="_parent" did not work for some reason
Thank you Vipul Behl for leading me in the right direction!

Show urls o/p in iframe

i am using feeds module for import news items.By using views,i display the news title,description and item url.In this,when user hit the item urls means its loads that particular site inside my site.I try to use Iframe by way of "output rewrite option" in views.But that page load fully instead of load inside my site.I use following code for that.
<iframe src="[url]" width="100%" height="300">
<p>[url]</p>
</iframe>
Any one please guide me resolve this.
thanks
This can be achieved using the target attribute on an a tag. For example when the user hit's the item URL it would load in the target window which in this case is the frame. Take for example the code below.
test
<iframe name="target_frame" src="http://www.google.com" frameborder="0" width="300" height="300"></iframe>
The frame initially loads google.com but once the link is clicked the target attribute on the a directs the click to the frame which has the same name attribute, in this case target_frame
You can read more about the target attribute here http://www.w3schools.com/tags/att_a_target.asp

How to set sound volume to 0 in IFrame?

I have the following line in my Html file, which displays a video feed, how do I set sound volume to 0 in IFrame ? So that when the page is first loaded, there is no sound.
<iframe src="http://onionz.co.cc/ain.php?psid=1626397" id="player" scrolling="no" frameborder="no" align="center" Width=588 Height=351></iframe>
Is there a paremeter like "volume=0" in IFrame that I can set ?
I doubt that's possible. You could silence the systems volume, or the process volume at most.
But that would mute the whole browser, not just the iframe!.
What you may be able to do is use javascript to manipulate the videofeed and silence it, but not the iframe as your requesting.

asp.net IFrame scroll bar push to top . .

Heres a tricky one . .
I have a webpage (called PageA) that has a header and then simply includes an iframe. Lets call the page within the iframe PageB. PageB simply has a bunch of thumbnails but there are a lot so you have to scroll down on PageA to view them all.
When i scroll down to the bottom of the pageB and click on a thumbnail it looks like it takes me to a blank page. What actually happens is that it bring up the image but since the page that is just the image is much shorter in height, the scroll bar stays at the same location and doesn't adjust for it. I have to scroll up to the top of the page to view the picture.
Is there anyway when i click a link on a page that is within an iframe, the outer pages scroll bar goes back up to the top
thks,
ak
#mek after trying various methods, the best solution I've found is this:
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).
Javascript is your best bet. You can use the scroll() method to scroll back up to the top of your IFRAME. Add a javascript handler in the body load so that each time you click a thumbnail, call a function that calls scroll() to scroll up.
I've spent a considerable amount of time trying to figure out how to scroll to the top of the iframe from within the PHP code I was calling (from within the parent ASP.NET page). I never figured I could scroll to the top using the same javascript but in the iframe's onload event. Thanks!

Resources