Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Splash screen compatibility issues

Back to Forum: Tech Off
  • User profile image
    lesmemphis

    I've got a splash screen that displays before the default page is loaded for my website.

     

    It displays perfectly in IE, but not in firefox. How do you add a splash screen in firefox?

     

    (let me know if you need to see the code)

  • User profile image
    W3bbo

    Well, let's start off with the fact splash-screens are a big "no-no" in the first place.

     

    Anyway, if something renders right in IE and not FF, then chances are you're doing something wrong (since FF implements the current specifications better than IE, in cases where IE renders differently it's usually when it deviates from or breaks with the specification)

     

    We'll need to see your code. I hope you're not using tables for layout.

  • User profile image
    lesmemphis

    W3bbo said:

    Well, let's start off with the fact splash-screens are a big "no-no" in the first place.

     

    Anyway, if something renders right in IE and not FF, then chances are you're doing something wrong (since FF implements the current specifications better than IE, in cases where IE renders differently it's usually when it deviates from or breaks with the specification)

     

    We'll need to see your code. I hope you're not using tables for layout.

    I'm not fond of splash-screen either. The boss wants to preview the site to select clients (although the site isn't done yet), and therefor instructed me to put a splash screen befon the wedsite loads stating the site isn't officially live yet.

     

    Code follows:

     

    I call this js file from my main:

     

    var splashpage=
    {
    splashenabled: 1,

    splashpageurl: "SubPages/SplashPage.aspx",

    enablefrequency: 0,

    autohidetimer: 4,

     

    launch:false,
    browserdetectstr: (window.opera&&window.getSelection) || (!window.opera && window.XMLHttpRequest), //current browser detect string to limit the script to be run in (Opera9 and other "modern" browsers)

    output:function()

    {
        document.write('<div id="slashpage" style="position: absolute; z-index: 100; color: white; background-color:white">')
        document.write('<iframe name="splashpage-iframe" src="about:blank" style="margin:0; padding:0; width:100%; height: 100%"></iframe>')
        this.splashpageref=document.getElementById("slashpage")
        this.splashiframeref=window.frames["splashpage-iframe"]
        this.splashiframeref.location.replace(this.splashpageurl)
        this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
        if (!/safari/i.test(navigator.userAgent))
        this.standardbody.style.overflow="hidden"
        this.splashpageref.style.left=0
        this.splashpageref.style.top=0
        this.splashpageref.style.width="100%"
        this.splashpageref.style.height="100%"
        this.moveuptimer=setInterval("window.scrollTo(0,0)", 50)
    },

     

    closeit:function()
    {
        clearInterval(this.moveuptimer)
        this.splashpageref.style.display="none"
        this.splashiframeref.location.replace("about:blank")
        this.standardbody.style.overflow="auto"
    },

     

    init:function()
    {
        if (this.enablefrequency==1){ //if frequency control turned on
            if (/sessiononly/i.test(this.displayfrequency)){ //if session only control
                if (this.getCookie(this.cookiename[0]+"_s")==null){ //if session cookie is empty
                    this.setCookie(this.cookiename[0]+"_s", "loaded")
                    this.launch=true
                }
            }
            else if (/day/i.test(this.displayfrequency)){ //if persistence control in days
                if (this.getCookie(this.cookiename[0])==null || parseInt(this.getCookie(this.cookiename[0]))!=parseInt(this.displayfrequency)){ //if persistent cookie is empty or admin has changed number of days to persist from that of the stored value (meaning, reset it)
                    this.setCookie(this.cookiename[0], parseInt(this.displayfrequency), parseInt(this.displayfrequency))
                    this.launch=true
                }
            }
        }
        else //else if enablefrequency is off
            this.launch=true
        if (this.launch){
            this.output()
            if (parseInt(this.autohidetimer)>0)
                setTimeout("splashpage.closeit()", parseInt(this.autohidetimer)*1000)
        }
    },

     

    getCookie:function(Name){
        var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
        if (document.cookie.match(re)) //if cookie found
            return document.cookie.match(re)[0].split("=")[1] //return its value
        return null
    },

     

    setCookie:function(name, value, days){
        var expireDate = new Date()
        //set "expstring" to either an explicit date (past or future)
        if (typeof days!="undefined"){ //if set persistent cookie
            var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days))
            document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; "+splashpage.cookiename[1] //last portion sets cookie path
        }
    else //else if this is a session only cookie setting
        document.cookie = name+"="+value+"; "+splashpage.cookiename[1] //last portion sets cookie path
    }

    }

    if (splashpage.browserdetectstr && splashpage.splashenabled==1)
        splashpage.init()

     

     

    The splash-page (SubPages/SplashPage.aspx), is just a simple form with a label stating the site is in test phase and not live and a countdown timer. (redirecting in...) (the timer just counts down, it doesn't redirect, because it's already done in this js file.

     

    Thanks for the help! It is very much appreciated!

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.