close popup opened by embeded Flash - javascript

I have my html where I embed third-party flash video by means of iframe. When I click play on the video a popup is opened.
I was wondering id there is a way to add a javascript function to my html that would close such a popup immediately when it is opened?

No I'm afraid not. The popup window belongs to the iframe, which as you explained is third party content and thus on a different domain to the host site.
Security restrictions prevent javascript from actiong on windows or documents across domains. This is called the Same Origin Policy.

Related

Is there a way to close tab opened by a script from an iframe?

I have added an iframe to my webpage that is used for converting video links to mp3 format.
iframe shows a button that, when clicked, opens a new tab before starting to download the wanted mp3 file. I would like to know if there is a way in javascript to close that newly opened tab to ensure a better user experience. I know that window.close() can do that, but not sure if we can apply that to a tab opened by a script from an iframe.
This is the iframe in question, It sends a get request to the link specified in the src attribute.
<iframe id="downloadIframe" src="https://loader.to/api/button/?url=${vidLink}&f=mp3&color=0964D3"></iframe>
When the iframe is loaded, you can see this in the code it loads with it:
<a id="downloadButton" onclick="onClick();window.open('https://loader.to/ajax/a.php');" href="#">
I believe that the opened window is caused by window.open().
Knowing that I cant change the code that is within an iframe, any idea how I can close that tab?
Open the dowlnoad in a iframe instead of a tab.
Then you can later drop the iframe from the DOM making it disappear.
you can block the iframe from opening new tabs by using the sandbox attribute.
sandbox=""
Sandbox Applies extra restrictions to the content in the frame. The value of the attribute can either be empty to apply all restrictions or space-separated tokens to lift particular restrictions.
You can read more about it here

Avoid visitors viewing the iframe content in a new browser tab

I have an IFrame with an external content which i can't modify because of Same-origin policy
My problem is i want to avoid visitors viewing the iframe-content out of the context of the main page (e.g. because they followed a link in search-results) but i have no control of it !
When people click a link or something in the page, it is open in a new tab and not inside the iframe ! All i want is a full embedded browser.
How can i avoid this if i don't have control of the iframe content ? I can see the html with the "inspect element" function of the browser but i cannot do it with javascript because of Same-Origin-Policy.

Can you capture a popup and load it in the parent/opener screen?

I am working on an app where I have a flash app that access a URL through an iFrame. The contents of the iFrame is 3rd party content. The content is a menu that you can navigate through but once you get to a certain point, the menu launches a pop up, and the popup is the continuation of the menu.
I was wondering if there is anyway that I could capture the popup and make it load within the parent/opener page, using jQuery perhaps to change the contents of the iframe?
This solution is probably way out there but I was just hoping for a nice quick fix.
The reason that this is a problem is that the app is for a tablet and the popup doesn't appear within an app on the tablet.
Thanks
If the iFrame content is served from a different domain than the parent/owner document, you're out of luck - that is, if you have no control over the iframe content. This is due to JavaScript's same origin policy.
If you are able to modify the web app running inside the iframe, you could try using window.postMessage (HTML5) to notify the parent window.

iFrames and hyperlinks, click a link in one iFrame to open in another

So, lets say there are two iframes, ifra0 and ifra1. Hyperlinks in ifra0 are fun to click but it would be nice to just have them open in ifra1 instead of a new tab or window. How can I accomplish this using Javascript? I do not have control over the content of these pages.
The page with the iframes is hosted on my computer, the iframes are webpages on the Internet.
EDIT: HTML4 Transitional would be okay.
Frames can communicate using postMessage() in co-operative Javascripts.
https://developer.mozilla.org/en/DOM/window.postMessage
The Javascript must be loaded in every <iframe>
Older browsers may not be supported
http://ajaxian.com/archives/cross-window-messaging-with-html-5-postmessage
Catch click() event in one IFRAME
Convert it to postMessage() message
Post it to the target frame
Target frame parses the message and performs window.location change based on the message payload
Though I am not sure whether the top frame hosting two iframes must be co-operating or not.

What javascript code/library can I use to open a Pop up on browser window from a small iframe contained in the webpage?

I want to open a remote url inside a javascript popup instead of doing window.open().
I came across libraries like lytebox,lightbox,thickbox which do that if the popup is opened from main webpage.
However my requirement is to open the popup from the link which occurs in a small iframe within the main page.( I can not alter the code of the main page, however Iframe webpage is fully in my control)
When I include those libraries in my iframe webpage, it opens the popup, but restricted only
to within iframe.How to make it appear over whole browser window ?
This is what i want : The user clicks on "click here" and it opens a javascript layer,not
restricted to within iframe.
you can just use
parent.document
from the iframe to access the parent window, if it is from the same domain. Otherwise, security concerns are raised.
You can inject the javascript by creating a script element in the parent's document, and then will be able to access the necessary functions.

Categories