...

View Full Version : Reading from frame



prays
06-10-2007, 05:29 PM
Hi all,

I'm looking for someone who can help me creating a piece of code. The code should read either the content of a frame, which contains an external website, or the URL. Then it should run a loop, to check if the URL in the frame changes, and when it does, then run a function.

I have tried to make this in javascript, but i found out that javascript dosn't allow to read the URL from windows or frames which contain content from another server.
I have seen this been used on a couple of sites, but none of them are willing to help me out, but just if it can help you guys, here they are;

http://www.komogvind.dk
http://www.lotsmorefree.com <- Probably the best example

I hope you can help me, thanks!

GCharb
06-10-2007, 06:51 PM
Hello there

I suggest you put your url thingy into a div, javascript allows you to get pretty much anything from those with a commend like


var varName = document.getElementById("DivName").innerHTML;

Then you could use javascript to deal with the variable content

GCharb

whizard
06-10-2007, 10:47 PM
PHP can't do that, since PHP is a server side language. When a PHP file is requested from the server, the server runs through the PHP code, executes it, and then sends the output to the client. Once the output is sent, PHP is out of the picture until the next request to the server.

HTH
Dan

prays
06-11-2007, 12:44 PM
Okay.. But does anyone have a suggestion to how this problem can be solved?

GCharb
06-14-2007, 03:24 PM
Hello again!

First of, not sure what you mean by a frame containning an external website, unless you mean an iframe.

Still, I am not clear on what you want to achieve. You want to run a javascript function or a php function on content change?

to read the source url of an iframe you could try this


var url = document.getElementById("iFrameID").src;

then use javascript to loop and check if it changed every few seconds or minutes or hours, just a thought.

GCharb



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum