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 10 of 10
  1. #1
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can you make this script x-browser compatable...

    Right, I have this chatroom that I made with PHP, and krycek suggested that I do something about it to stop the flicker on the iframe.

    He made this script...

    Code:
    function chatLoad() {
    	if (parent.mess.document.readyState == "complete") {
    		parent.mess.document.location	= 'messages.php';
    	}
    	timer					= window.setTimeout("chatLoad()", 4500);
    	chatRefresh();
    }
    chatLoad();
    function chatRefresh() {
    	if (parent.mess.document.readyState != "complete") {
    	// readyState can be; uninitialized, loading, loaded, interactive, or complete
    		timer				= window.setTimeout("chatRefresh()", 4000);
    	} else {
    		var html			= parent.mess.document.body.innerHTML;			
    		chat.innerHTML			= html;
    	}
    }
    mess is the name of my iframe

    chat is the name of my div to load the chat into.


    It works fine, you can have a look: www.itk-network.com/box, but I would appreciate it if someone could help me make this cross browser compatable.

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    at first glance, it looks compatible to me. is it not working in a certain brower?
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It doesnt work in Mozilla.

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    According to my reference, there is no readyState property to document in the Gecko DOM.

    Must be an IE-only thing
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #5
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Right, thanks...

    In that case, is there another way to get the same effect?

  • #6
    Regular Coder
    Join Date
    Nov 2002
    Location
    Bristol, UK
    Posts
    932
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks matt for giving me credit there

    I wrote that script kinda quick so I didn't have chance to worry about compatibility.

    beetle is right about readystate - and I don't know of a x-browser alternative, or I would have given one first time round

    any ideas about how to duplicate the effect of readystate (i.e. how to tell that the page has finished loading within the iframe) would be great

    ::] krycek [::
    ithium | SOAPI | SDP | PTPScript manual
    "ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."

  • #7
    Regular Coder
    Join Date
    Nov 2002
    Location
    Bristol, UK
    Posts
    932
    Thanks
    0
    Thanked 0 Times in 0 Posts
    LOL stupid me! :slaphead:

    Matt, just put a call to the JS function inside the page you are loading. When the page has loaded in the iframe, it will call the function etc.

    I'm sure you can integrate it easily enough

    ::] krycek [::
    ithium | SOAPI | SDP | PTPScript manual
    "ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    a barmy thought
    at the end of the I frame page
    <script>
    parent.document.foo():
    </script>

    in the main page
    <script>
    function foo(){
    alert("page has loaded")
    }
    </script>

    or simply at the end of the I frame page
    <script>
    alert("page has loaded")
    </script>

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #9
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That seems so obvious now.

    Thanks for all your help krycek.

  • #10
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    And scroots, who posted at about the same time


  •  

    Posting Permissions

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