Parker Software Ltd Homepage
Forum Home Forum Home > WhosOn Live Chat > FAQ's > Advanced FAQ's
  New Posts New Posts RSS Feed - Hiding the image if the gateway goes down
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Hiding the image if the gateway goes down - Event Date: 12 Apr 2007 - 13 Apr 2007

 Post Reply Post Reply
Author
Message
Daniel View Drop Down
Admin Group
Admin Group
Avatar
Technical Director

Joined: 19 Dec 2006
Location: Stoke-on-Trent
Points: 881
Post Options Post Options   Thanks (0) Thanks(0)   Quote Daniel Quote  Post ReplyReply Direct Link To This Post Calendar Event: Hiding the image if the gateway goes down
    Posted: 12 Apr 2007 at 12:23pm
If the WhosOn gateway went down for any reason (network connectivity for example) or traffic on port 80 was blocked for some reason, then you don't want the broken link showing.

A small modification to the javascript can fix this so the image is hidden until it has full loaded.

Line 80:


document.write("<a target=\"_blank\" href=\""+sWOChatstart+"\" onclick=\"javascript:window.open('"+sWOChatstart+"','new_win','width=484,height=361');return false;\"><img border=\"0\" src=\""+sWOUrl+"\"><\/a>");


We want to change this to enclose it in a easily hideable div, and add a function to the onload portion of the image.


document.write("<div id='whoson_image_div' style='visibility:hidden;'><a target=\"_blank\" href=\""+sWOChatstart+"\" onclick=\"javascript:window.open('"+sWOChatstart+"','new_win','width=484,height=361');return false;\"><img border=\"0\" src=\""+sWOUrl+"\" onload='sWOImageLoad()'><\/img><\/a><\/div>");


Then we specify the sWOImageLoad function at the bottom of the javascript file:


function sWOImageLoad(){
// image has loaded let's show it.
document.getElementById('whoson_image_div').style.visibility = "Visible";}


If the image doesn't load then this function is never called, meaning that the image remains hidden.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.05
Copyright ©2001-2016 Web Wiz Ltd.

This page was generated in 0.063 seconds.