Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reading from frame

    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!

  • #2
    New Coder
    Join Date
    May 2007
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    If you have nothing good to say about someone, say nothing at all!

  • #3
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    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
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #4
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay.. But does anyone have a suggestion to how this problem can be solved?

  • #5
    New Coder
    Join Date
    May 2007
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

    Code:
    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
    Last edited by GCharb; 06-14-2007 at 03:26 PM.
    If you have nothing good to say about someone, say nothing at all!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •