How to get updated iframe source - iframe

How can i get the updated iframe src value after my user navigates throught the site that is inside the iframe?
I'm asking this because the src value is always the same! It don't change even if you navigate inside the iframe.
Thanks

easiest way is to use javascript to dynamicly refresh the <iframe> by setting the src to a given interval refresh rate.
Have a look at the below example
dynamicly refresh iframe without refreshing current page

Related

Stuck in iFrame, how to get out?

I'm using ASPX web pages (WebPage1.aspx) and have an HTML iFrame defined in this page. I dynamically define the iFrame src (via code behind) when my ASPX web page loads ... all good so far.
The web page that gets loaded into my iFrame supports a "ReturnURL" that I've defined when I set the src for the iFrame. Something like:
src = "https://www.someothersite.com/Somewebpage.aspx?ReturnUrl=http://www.mywebsite.com/WebPage2.aspx"
The web page (Somewebpage.aspx) has a "Return" button, the user clicks the Return button and they should get redirected back to the "ReturnURL" I specified (http://www.mywebsite.com/WebPage2.aspx).
What happens is http://www.mywebsite.com/WebPage2.aspx gets displayed in my iFrame on http://www.mywebsite.com/WebPage1.aspx. This IS NOT what I wanted, I wanted to simply be return to http://www.mywebsite.com/WebPage2.aspx.
Is there a solution to this problem within the context of ASPX and code behind?
Cheers, Rob.

Backbone Project, How to navigate back when there is a iframe within the view?

How to navigate back when there is a iframe within the view?
After user clicks on a link to other pages from within the iframe, the browser history gets append on to it as well so that I cant use "window.history.back()" to go back, since "-1" will take user back within iframe and not the actual app itself.
What is a good way to solve this so that when back button pressed its the previous "route" and not the history of iframe history?
try doing something like this, from the Iframe:
window.top.history.back();
or
back to backbone app
This way you are accessing the Iframe's parent window history, not the Iframe itself. As long as you navigate to the Iframe from your SPA, this should work.

Browser history with iframes on page

I have a page with some links and a few iframes. When the user clicks on any link the content is loaded in iframes. Now I want to integrate it with browser back button. In order to achieve this what I am doing is when any link is clicked I change the window location hash and then listens for onhashchange event. When the event fires, it is handled and looking at the hash value I(restore the state and) load the content in iframes. For loading the content in iframe I use window.location.replace() method to prevent it from appearing in the history and interfere with working of back button. Is there a better approach that can be taken to achieve the above functionality? Please note that removing iframe is NOT an option. Any help is appreciated.
Why don't you just use the iFrame's history? As it is a seperate context and it's own web browser in a way, it has it's own history.
Try:
document.getElementById('id_Of_ Iframe').contentWindow.history.back();
you can have a button like this
input type="button" onClick="history.back()" Value="Back"
Hope it will help.

stop cross-domain IFRAME links to open in "_top" target

My page loads an IFRAME with content from another domain (and I don't have control over the content) that contains links with target="_top" attribute. My page gets completely replaced once the user clicks on one of these links. Since my page is a stateful web application it would confuse the user.
Is there a way/trick to stop those IFRAME links to do so? They should either (visually) load within the IFRAME or open in a new window.
I don't want to proxy the IFRAME using a server script and alter the HTML code since this would block any user cookies for the foreign domain.
Perhaps some special trick like nested IFRAMEs or whatever could do this?

Get URL of link clicked inside frame/object

So, I have a page (page1.html) and then I have an iframe or object serving up some other page (page2.html) within that page... What I want/need is when the user clicks a link inside the iframe (page2.html) i need a way for page1.html to recognize that the iframe href has changed because the link is loaded into the iframe.
There is no onload event for the object/iframe element so i can't figure out when the user has clicked a link inside the IFRAME (page2.html)...
You have very little control over what happens in an iFrame. Essentially, once you load it, you have no power over it, and you can't see what happens in it. (You can still tell it to load something else.) If you want that sort of control, you should really be using AJAX, i.e. you should be loading new content into the document object model dynamically.
right click on the link and then click open in a new tab / new window, this will open the webpage in a new tab , then copy the url from the address bar of the browser.

Resources