I have MAINPAGE.php which launches an iFrame. In this iFrame there can be any link opened and the user can click links and view different pages in the iFrame.
What I would like is that each time the user navigates to a page within the iFrame, the parent window will include the url of that page but just as a reference. So if I visit google in the iFrame the MAINFRAME.php should be changed to MAINFRAME.php#http://www.google.com. Then when I visit Yahoo, the url should be changed to MAINFRAME.php#http://www.yahoo.com.
This change should be textual only and should not affect navigation at all, so using _top or "top.window.location.href" and co. is not an option as it will exit the iFrame.
The idea is to have the ability to access the URL of the page in the iFrame from the URL of the parent.
Any idea?
Related
I have a page with the form that is embedded via iframe (GTM installed on both sides). When a visitor lands on the parent page, the I-framed form needs to pick up UTM's from the URL to pass to the CRM with the lead. Because visitors landed on the parent and not on the child page (form URL), the form is unable to do that.
Is it possible to append UTMs from the parent URL to the Iframe link on the parent page?
Once UTM's are in the form URL, the form should be able to pick up automatically.
Thank you.
This is the link on the parent page
I am working on a payment website, which needs to integrate a 3rd party website inside an iframe. However, at some point, the user can click a button inside the iframe, which redirects the parent window to another URL.
I cannot touch the 3rd party code.
Is it possible to capture this URL the parent window is being redirected to, stop this redirection, and pop up another window for that URL?
Thanks for any help.
You will be able to detect when the iframe's url changes, but you will not be able to look at what the new url is. That may be just enough. If the user clicks something in the iframe, and the iframe changes url, then you can detect that and redirect the parent window.
Plain javascript solution:
<iframe
src="https://target.com/page"
onload="alert('iframe has loaded or changed')">
</iframe>
jQuery solution:
<iframe class="target-iframe" src="https://target.com/page"></iframe>
$(document).on('load', '.target-iframe', function () {
alert('iframe has loaded or changed')
});
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.
This is a tricky one. I have a link on my page that opens a Colorbox iframe to an external website. The external website contains links to another page. When the user clicks those links, I need them to load up in the same iframe.
The problem is, the link on that external site is set to open a new window with target="_blank". Therefore, instead of this page loading within the same colorbox iframe like I need it to, it opens a totally new window.
Is there any way to bypass it so that these links within the iframe do not open a new window, and instead load that window within the same colorbox iframe?
Thanks in advance!
_blank will always open a new window, you could try _TOP instead, it should work something like this;
<a onclick="parent.$.fn.colorbox.close();" href="NEW SITE" target="_top">
open in parent window with animation
</a>
Do you control the document that is being displayed in the iframe? If so you could handle things a little differently so that you only opened new windows if the document isn't being displayed in an iframe. But if the document you are iframing isn't under your control then I don't think there is anything you can do about it.
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.