Print Page | Close Window

Hiding the image if the gateway goes down

Printed From: Parker Software Ltd
Category: WhosOn Live Chat
Forum Name: Advanced FAQ's
Forum Description: FAQ's for advanced users.
URL: http://www.parkersoftware.com/forum/forum_posts.asp?TID=6652
Printed Date: 27 Jan 2022 at 9:40pm
Software Version: Web Wiz Forums 11.05 - http://www.webwizforums.com


Topic: Hiding the image if the gateway goes down
Posted By: Daniel
Subject: Hiding the image if the gateway goes down
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.05 - http://www.webwizforums.com
Copyright ©2001-2016 Web Wiz Ltd. - https://www.webwiz.co.uk