My tool can display external websites in an iFrame.
Few sites (e.g. "http://ec.asm.org/") are loading in my iFrame but after few seconds reloads on the same browser's tab but not as iFrame.
I suspects that it happens because the destination websites changing their location (redirection) to the same url during the page load (onLoad).
Is there way to verify this assumption (redirection to the same page)?
Is there any other possible reason for this problem (iFrame closed)?
Related
I have a service which loads third party content to my page using iframe. I have no access to modify the page i'm loading within the iframe.
I have to refresh the page which hosts the iframe in case the page within iframe gets refreshed. I do not want to refresh the parent page in case there's a redirect inside the iframe. Which essentially boils down to me having to differentiate between page redirect and page refresh inside the iframe element.
My initial thought was to use the onload event, but due to CORS issues, i'm unable to actually determine the source of the page it opened (so I cannot track whether it reloaded or redirected).
Is there a way to distinguish between page redirect and page refresh within the iframe?
the difference between reload and refresh. is that reload is (computing) to refresh a copy of a program in memory or of a web page on the screen while a refresh is (computing) the update of a display (in a web browser or similar software) to show the latest version of the data.
I have a webpage that displays an iframe containing a random website. After 10 seconds I want the website within the iframe to replace the "parent" website.
Let's say my website www.aaa.com has an iframe containing the website www.bbb.com. After 10 seconds I want the browser to replace the currently open www.aaa.com with www.bbb.com without reloading the page so the user doesn't lose their state. Basically replacing the document and updating the URL bar accordingly.
I can't just get the URL of the iframe and change location as the user could for instance be watching a video and it would start again from the beginning because of the page reload.
I've been searching for this for a few hours and there is absolutely nothing that I could find.
You can set window.location = "//www.bbb.com" but it will just fetch that webpage as usual.
You can set an url in the browser using window.history.replaceState(null, "test", "www.aaa.com/mypage?foo=bar") but it will fail crossdomain (it will even fail using a subdomain on your site).
And you cannot get the contents of a cross-domain iframe.
These are all related to cross-origin security. There may be exceptions, such as when you have elevated permissions (browser plugin). Some functionality may be available using CORS and what not, but you need cooperation from the owner of the other domain.
In short, the closest to what you want is probably to set the iframe to the full width/height of the window.
We use a product at my company that allows us to embed secure forms on non-secure sites to transfer information. We do this through embedding an iFrame.
We use Google Tag Manager for most of our clients, and we have a module for tracking submissions of these forms. However, because of it being in an iFrame, every time we submit a form, the source of the traffic is a referral from the parent website, the one loading the frame, not the source of the traffic, throwing our analytics off.
More information:
We're using cookieDomain set to auto on all pageviews and events
GTM is installed on both the page loaded in the iFrame, and the page loading the iframe.
Pageviews are currently set to track on All Pages except for the domain the iFrame is on, but I've tried setting it to All Pages and it still tracks form submissions as a referral.
Tl;dr Form is in an iFrame. I land on a page with this iFrame from Facebook. When I submit the form, the source is the page with the iFrame, not Facebook. I want the source to be Facebook. How can I pass the cookie from the parent page to the iFrame, where the event occurs, within GTM?
I wrote a chrome extension which injects a toolbar on top of sites (say amazon.com) as an iframe at the top.
When the user click on the action button on the toolbar (inside iframe), it's basically a form submit action, with action pointing to my full site (on another domain).
It's working, however only inside the iframe. I'd like the whole page to redirect to my site, rather than the iframe.
Is there anyway to do that in extension?
If you are using an iframe :
Same Origin Policy prevents you from doing this.
Unless you can hack/XSS the other site's files to inject the JS, you will have a hard time.
Now if you legitimately need to communicate with the other page, and you either have control of the other page or can setup it to communicate with your server, you can use window.postMessage, JSONP or even Ajax with CORS (latter 2 will be harder to pass dynamic content though). But I believe it is not the case.
else :
you can directly inject the js script in to the page itself by that you can handle all operations in the main page same as running something on chrome console.
I'm trying to access the URL of an iFrame that I open on my site. The iFrame is from another domain so traditional methods violate the same origin policy and are flagged as cross site scripting. However, I just discovered window.postMessage, but I don't quite know how to pull it all together.
My goal is to capture the final URL in the iFrame. For example, a user clicks a button on my site to open an iFrame. Say that iFrame loads a web site and the user clicks around on the site. When they close the iFrame, I want to capture the URL so the next time they click the button on my site, I can open the iFrame to the same state that the site was in last time they visited. Is this possible with window.postMessage?
Thanks!
document.iframe[name].src
document.iframe[name].document.location.href