prevent html page from open a new window - javascript

I have a html based application and sometimes my html app needs to open another url in iframe.
the problem is that the third party url in the iframe open a new window too with the same content, the same url.
so how can i prevent it?

This seems like an iframe breakoutscript in the thirdparty page. A few links about a solution to this problem.
http://stuntsnippets.com/prevent-iframe-breakout/
http://www.zimbio.com/Web+Design/articles/1110/How+prevent+iFrame+breakaway
How to prevent IFRAME from redirecting top-level window

Related

How do I prevent a link inside an iframe from opening in a new tab?

I'm new to Html and Javascript. I've been making an iframe browser with the help of an extension. see my GitHub page
One of the issues my users face is that some links and redirects that occur in the iframe open in a new tab. How do I prevent this and allow the redirects and links(when clicked on) to open in the iframe? If not possible, is there a way to get the URL of the link before the page is redirected?
I tried adding <base target="_self"> in the head of the page.

Iframe. How to redirect inside iframe?

I have iframe on my site. In this iframe another site is displaying. After submitting form in iframe location.href is changed. It leads to top level window redirect.
So, I want to change location of iframe instead of changing location of top-level window.
How can I do that?
Thanks!

new window/tab event from an <iframe>

I have an iframe in my website which its content is dynamic and I can't control it.
Is it possible to detect a new-window/tab opened from this iframe using Javascript?
Thanks!
You could do this, but in some weird way :)
If you can edit html on the server where iframe source loads from, place there another iframe (style="width:0px;height:0px;display:none") with src="http://your site/control page".
This trick will give you DOMdocument control by js on the both side of iframe.

Open links from an external website that sits in an Iframe in a new window

I have a website with an iframe on one page that goes to an external URL (which I have no control over). I am trying to find a way to have all the links in the Iframe (not the entire page) open in a new window. I've tried a couple solutions with no luck. Is there a way I can target the iframe and use the HTML base tag?
Due to the Same Origin Policy, you can only modify the contents of an iframe if the domains and protocols match.

Salesforce page popup opens with another url

on the standard account layout i have a custom button that opens a new popup window with a visualforce page. My problem is that the layout page have an url like xxx.salesforce.com/xxxxxx and the popup page opens in url like x.xxx.visual.force.com/apex/myPageName
So i can not access parent window, for example reload it with window.opener.location.href I become an error: Permission denied to access property 'href'.
Do you have an idea how i can open popup in same url?
Many thanks.
Visualforce pages always open under the visual.force domain this is to stop Cross-Site Scripting attacks being embedded in visualforce pages accessing your data.
The simplest way to achieve what you're after is to server your account layout from the visual.force domain by creating a visualforce page something like the below
<apex:page standartcontroller="Account">
<apex:detail />
</apex:page>
My solution was: i used a redirection to the visualforce page (not a popup window).

Categories

Resources