Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: loading javascript in window not pop up

  1. #1
    Join Date
    Jul 2009
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default loading javascript in window not pop up

    Hi,

    I have prochatrooms installed on my site/vb forum, the code they gave opened it up in a pop up window only and they don't know the code to make it open up directly on site.

    What would I change or use to make the following code open but not open in a pop up:

    Code:
    window.onload=function() { launchChat(); };
    If you need more info, tell me what u need and ill provide it .

    Thanks to anyone who replies

    Eddie

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    We would need to at least see the launchChat function. Perhaps the entire thing:

    Please post a link to the page on your site that contains the problematic code so we can check it out.


    If the pop up is not a true window, it may be difficult. If it is a true window, we can redirect the page that populates it to virtually any window including the present one. If however, as I suspect, it is a pop up division, we could possibly make it take over the page or most of the page perhaps, maybe make it be the page itself, depends upon the code involved.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2009
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Link to site: http://www.ibass-radio.com/radio/
    but u need to register to have the chat room pop up (ive made it auto pop up when ur signed in as a member).. .. guests cant use the chat room .. u can quickly register thru the facebook connect button..

    This is the code they provide that i add my own site link to:

    Code:
    <script language="JavaScript">
    <!--
    var userName = "$bbuserinfo[username]";
    var userID = "$bbuserinfo[userid]";
    var roomID = "Lobby";
    // -->
    window.onload=function() { launchChat(); };
    </script>
    <script language="JavaScript" type="text/javascript" src="http://www.ibass-radio.com/prochatrooms/chat.js"></script>
    If is possible .. maybe theres a way to have the chat in an iframe .. but the link at the top of the chatroom when popped up is:

    Code:
    http://www.ibass-radio.com/prochatrooms/index.php?uid=**&uname=*****&room=Lobby
    If I can put coding in where it has the *s above .. if the code can pull the members info from the forum it could maybe be done as an iframe if u get me ..

    Hope that info helps .. if u need more let me know

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Should be easier than I thought, as it's opening a true window. If you want it to open in an iframe, just edit chat.js to look like so (change highlighted):

    Code:
    function launchChat() 
    { 
    var xOffSet = (screen.width - 225) / 2;
    var yOffSet = (screen.height - 500) / 2;
    var features = 'width=900,height=700,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1';
    var winName = 'prochatrooms';
    var chatUrl = 'http://'+location.hostname+'/prochatrooms/index.php?uid='+userID+'&uname='+userName+'&room='+roomID;
    myWin = window.open(chatUrl,winName);
    
    function createCoo . . .
    Place an iframe on your page:

    Code:
    <iframe name="prochatrooms" src="about:blank" width="300" height="300" scrolling="auto" frameborder="1"></iframe>
    The highlighted part is important, the width and height are up to you to determine. The src can be any page, or left as "about:blank", whatever you use there will be displayed to the user unless and until they launch the chat. Scrolling should probably be left as auto, but may be changed to "yes" or "no". The only other option for frameborder is 0 for no border, though ordinary css style may be used to control the border, position, and many other properties of the iframe element. Editing the prochatrooms/index.php file may be required for certain things.

    To give the user the opportunity to click on a button or link to launch chat, just give that button or link this event attribute:

    Code:
    onclick="launchChat();return false;"
    example:

    Code:
    <a href="#" onclick="launchChat();return false;">Chat</a>
    But unless you remove:

    Code:
    window.onload=function() { launchChat(); };
    the chat (assuming we've done this right) will load in the iframe on page load anyway.

    Now, if you want the chat to take over the entire page. That's even easier, just change (in chat.js again):

    Code:
    function launchChat() 
    { 
    var xOffSet = (screen.width - 225) / 2;
    var yOffSet = (screen.height - 500) / 2;
    var features = 'width=900,height=700,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1';
    var winName = 'prochatrooms';
    var chatUrl = 'http://'+location.hostname+'/prochatrooms/index.php?uid='+userID+'&uname='+userName+'&room='+roomID;
    window.location.replace(chatUrl);
    
    function createCoo . . .
    But if you do that, the cookie will probably not get set, so you would want to put that part first in the code:

    Code:
    function launchChat() 
    { 
    function createCookie(name,value,days) {
    	if (days) {
    		var date = new Date();
    		date.setTime(date.getTime()+(days*24*60*60*1000));
    		var expires = "; expires="+date.toGMTString();
    	}
    	else var expires = "";
    	document.cookie = name+"="+value+expires+"; path=/";
    }
    createCookie('login','login',1);
    
    var xOffSet = (screen.width - 225) / 2;
    var yOffSet = (screen.height - 500) / 2;
    var features = 'width=900,height=700,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1';
    var winName = 'prochatrooms';
    var chatUrl = 'http://'+location.hostname+'/prochatrooms/index.php?uid='+userID+'&uname='+userName+'&room='+roomID;
    window.location.replace(chatUrl);
    }
    There may be a link or button on the prochatrooms/index.php page that is for closing chat. You may want to remove it or change it. If you are having the chat take over the window (as opposed to launch in an iframe) you may want to change it to have an event such as:

    Code:
    onclick="history.go(-1);return false;"
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jul 2009
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John .. ur an absolute star ..ive spent couple of months trying to do this with no success even from prochatrooms themselves and vbulletin. Thank you very much for your help

    I now have it in iframe loaded on the front page of the forum thank you

    Question on the 2nd part you left about it taking over the whole page instead of in an iframe, can you explain what you mean by that, not too sure lol.

    Also adding a cookie, would that mean (if it was taking over the whole page) when you refreshed the page the previous chats would remain in the chat room and not disappear when you reload the page?

  6. #6
    Join Date
    Jul 2009
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hmmm one thing im noticing, is that its taking forever to load fully in internet explorer, but loads fine in firefox...not because of what we've just done, but wondered if you might know why too?

    Thanks

    Eddie

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The cookie doesn't appear to store much information. You could play around and see what happens and/or ask the prochat folks.

    Taking over the whole page would be just that. Instead of an iframe or pop up, the page would become the chat. Not such a hot idea for the index page.

    IE often takes longer to load things than other browsers. But there might be some reason this is (as you seem to be saying it is) taking a particularly long time. For specifics on that I would have to get back to you if I find anything concrete.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Jul 2009
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    okay .. thanks for your help on this, I'll try speak to prochatrooms and see about the cookie thing, ill leave as an Iframe as all is working nicely now. If you do find anything out about the loading time on IE if you don't mind letting me know..

    Appreciate the speedy and very helpful replies you've given .. thanks again John

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    To save me some time, did the chat take longer to load in IE when it was a pop up? How much longer is it really?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Jul 2009
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    well i just did a test .. and literally for the chatroom to work it takes 3mins 40 secs before u can actually type in it .. only on internet explorer..

    and yeh it has taken roughly the same time when it was a pop up

    preferably i wish all my members were on firefox as this loads up straight away .. but that wont happen lol ..

    any suggestions?

Bookmarks

Posting Permissions

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