PDA

View Full Version : Using Javascript with Iframe



jonnywales
04-11-2015, 04:55 AM
Hi...

I have a traffic echange which works well, what I want to do is this. When a user logs in he/she is taken to n oto or advertising webpage, the webpage is timed at 20 seconds when he/she will be redirected to their member area.

Javascript works ok/timer is ok/redirect is ok. but how do I show the actual OTO page/Advertising page?:mad:

I have tried using Iframes but all that happens is that the script shows twice.
5658

Can anyone help?

jscheuer1
04-11-2015, 04:04 PM
There are cross site restrictions on javascript. So, if one page is on one site, and the other is on another, they cannot communicate via javascript. That might play a role, as not even the location.href of an iframe may be set to off site resources in certain cases. You can always set its src property though. The href is is a property of an iframe as a window object (window.frames[0].href), the src is a property of the iframe as an element on the page (document.getElementById('myIframe').src).

Many off site resources refuse to allow your site to put their content in a frame/iframe or object tag. There's no way around that except to get the other site to change its policy.

And/or there may just be some other sort of problem.

If you want more help, please post a link to the page on your site that shows the problem.