Change url from another iframe


Girardler

I have a page with 2 iframe codes:

<iframe src="top.html" seamless="seamless" width=100% height=100% id="up" name="up" frameborder="0"></iframe>
<iframe src="main.html" seamless="seamless" width=100% height=800px id="main" frameborder="0"></iframe>

In main.html I have the following code:

parent.frames['up'].location.href = "top.html";

The idea is to refresh the "up" iframe. Sometimes it works fine, sometimes nothing happens, sometimes I get an exception:

Uncaught SecurityError: A frame with source 'null' is blocked from accessing a frame with source 'null'. Protocol, domain and port must match.

What am I doing wrong?

Girardler

I found the problem. The problem occurs when the page is loaded by double-clicking. The domain of the iframe and its parent must be the same. When loading the files by double clicking, they both have the domain "null" and since (null === null) returns false, an exception is thrown. In order for this code to work, I have to run it from a web server.

Related


Change parent window url from iFrame

Mai Ash I have a parent website at myurl.com from which I can load iFrames in overlay/modal layers. In the iFrame, I have different tabs for steps 1-5 with different form elements - in other words, a kind of checkout flow. Each tag is inside a div, eg. ID "tab

Change parent window url from iFrame

Mai Ash I have a parent website at myurl.com from which I can load iFrames in overlay/modal layers. In the iFrame, I have different tabs for steps 1-5 with different form elements - in other words, a kind of checkout flow. Each tag is inside a div, eg. ID "tab

Change url when loading from iframe

Ebin I have the following 3 pages form123.html ........... iframe form.php .................php code validate.php .............Validating php code In my form123.html page, with iframe loaded from form.php, now the url is http://www.ect.com/form123.html <iframe

Change parent window url from iFrame

Mai Ash I have a parent website at myurl.com from which I can load iFrames in overlay/modal layers. In the iFrame, I have different tabs for steps 1-5 with different form elements - in other words, a kind of checkout flow. Each tag is inside a div, eg. ID "tab

Change url when loading from iframe

Ebin I have the following 3 pages form123.html ........... iframe form.php .................php code validate.php .............Validating php code In my form123.html page, with iframe loaded from form.php, now the url is http://www.ect.com/form123.html <iframe

Change iframe's src from another HTML file?

blue eyes white dragon Well, I have mine with the radio elementsupdated one ; and it works great.iFramejs code Then, what I have buttonbelow is to create iFramea list that HTML Divisioncontains a bunch of O''s buttonsin the list, and my goal is to click on one

Safari, iFrame, change address bar to iFrame URL

Derek Conlon I have a form that when you click submit it goes to another .php page whose whole goal is to load an iFrame with a URL to Paypal. This allows us to let customers enter CC info without their CC info hitting our servers (to maintain compliance) The

Safari, iFrame, change address bar to iFrame URL

Derek Conlon I have a form that when you click submit it goes to another .php page whose whole goal is to load an iFrame with a URL to Paypal. This allows us to let customers enter CC info without their CC info hitting our servers (to maintain compliance) The

Safari, iFrame, change address bar to iFrame URL

Derek Conlon I have a form that when you click submit it goes to another .php page whose whole goal is to load an iFrame with a URL to Paypal. This allows us to let customers enter CC info without their CC info hitting our servers (to maintain compliance) The

Email URL from iframe

Riquelmy Melara I have a contact form that is supposed to send an email with a link to the product the user is currently viewing, the problem is that I need to use an iframe, because the server doesn't accept PHP files, so I need to do this: $name = clearValu

Email URL from iframe

Riquelmy Melara I have a contact form that is supposed to send an email with a link to the product the user is currently viewing, the problem is that I need to use an iframe, because the server doesn't accept PHP files, so I need to do this: $name = clearValu

Change url when iframe is refreshed

SP I wrote a page with an iframe structured like this: count.html: /* http://example.com/count.html */ <div class="primary"> <h2>Countdown</h2> <div class="content"> <iframe src="page2.html" id="iframe"></iframe> </div>

Change url when iframe is refreshed

SP I wrote a page with an iframe structured like this: count.html: /* http://example.com/count.html */ <div class="primary"> <h2>Countdown</h2> <div class="content"> <iframe src="page2.html" id="iframe"></iframe> </div>

How to update one iframe from another iframe?

dead in water I have an iframe with LOGIN and REGISTER buttons, the login button opens the login page in another iframe and the second iframe is refreshed after the login data is submitted. However, I also want to be able to update the first iframe to change t

How to detect iframe url jumping to another url

Yang Jian| I have a page login.php using iframe "src= http: //def.com/login ". My domain is example.com. After logout, the def.com jumps to http://def.com/home I want my page to jump from http://def.com/home to the iframe URL of my page http://example.com/logi

How to detect iframe url jumping to another url

Yang Jian| I have a page login.php using iframe "src= http: //def.com/login ". My domain is example.com. After logout, the def.com jumps to http://def.com/home I want my page to jump from http://def.com/home to the iframe URL of my page http://example.com/logi

Javascript change content of iFrame from inside iframe

extinguished How to change innerHTML of iframe from inside iframe? <iframe> foo <script> .... will change "foo" to "bar" ..... </script> </iframe> Daniel Baker iframes don't work that way. The innerHTML of the iframe tag is fallback content and is only disp

call iframe from another window

Paul Polon I have a link that passes the source to an iframe: <a href='new.mp4' target='showVideo'></a> <iframe src='sample.jpg' name='showVideo' ></iframe> What I want to do is to point the link <a>to a PHP file and have the new source returned for that file

Change url from one image to another using .htaccess

Jonathan Eustace I'm just migrating a website from one URL to another. Unfortunately, the last web developer used absolute URLs everywhere. There is an image that is requesting the old url, and since it's part of the image slider, it takes up to a minute for t

Change url from one image to another using .htaccess

Jonathan Eustace I'm just migrating a website from one URL to another. Unfortunately, the last web developer used absolute URLs everywhere. There is an image that is requesting the old url, and since it is part of the image slider, it takes up to a minute for

Change url from one image to another using .htaccess

Jonathan Eustace I'm just migrating a website from one URL to another. Unfortunately, the last web developer used absolute URLs everywhere. There is an image that is requesting the old url, and since it's part of the image slider, it takes up to a minute for t

Access parent url from iframe

chronofwar: Ok, I have a page on this page and on this page I have an iframe. What I need to do is on the iframe page, find out the URL of the home page. I searched and I know it's not possible if my iframe page is on a different domain as this is cross site s

Access parent url from iframe

chronofwar: Ok, I have a page on this page and on this page I have an iframe. What I need to do is on the iframe page, find out the URL of the home page. I searched and I know it's not possible if my iframe page is on a different domain as this is cross site s

Get current URL from IFRAME

Chris: Is there an easy way to get the current url from an iframe? Viewers will browse multiple sites. I'm guessing I'll use something in javascript. kkyy : For security reasons, you can only get that url as long as the content of the iframe and the referencin

Open URL from link to iframe

study hard I created the iframe, but not at first src. For example, when I click on a link, such as the result of a Google search, the link should try to open in that iframe. Not in the tab I'm currently browsing. $(document).ready(function () { $('<div

Pass URL parameters from iframe

Aaron I am hosting an iframe on my website which is served by a third party service. I cannot manipulate the source code of the iframe, which results in the user being able to navigate within the frame while the parent URL remains the same. E.g mysite.co.uk/ T

Get current URL from IFRAME

Chris: Is there an easy way to get the current url from an iframe? Viewers will browse multiple sites. I'm guessing I'll use something in javascript. kkyy : For security reasons, you can only get that url as long as the content of the iframe and the referencin

Access parent url from iframe

chronofwar: Ok, I have a page on this page and on this page I have an iframe. What I need to do is on the iframe page, find out the URL of the home page. I searched and I know it's not possible if my iframe page is on a different domain as this is cross site s