JS and page reloading problem (ads)

Discussion in 'JavaScript' started by YellowSlider, Aug 6, 2010.

  1. #1
    my forum url is - www.iatraf.co.il

    when browsing with IE 7 \ 8 each page reloads from the beginning (blank for a mili sec and then the entire page loads) it doesn't happens with FF \ Chrome.

    I mean that the header should not reload, but you can definitely see that the entire page reloads instead of just the content block under the header.

    well, it's something with our pop-under (kind of a pop-up) code (it's JS), I've tried to eliminate our ads and it was fixed just when I removed the popunder code.

    that's the code -
    <script type= "text/javascript" language="javascript" src="http://live.sekindo.com/live/liveView.php?s=5149"></script>

    Thanks.
     
    YellowSlider, Aug 6, 2010 IP
  2. YellowSlider

    YellowSlider Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    here is the JS code -

    function setCookie_5149(name,value,secTimeout) 
    { 
    		var domain = document.domain; 
    		domain = domain.replace("www.",".");
    
    		if (secTimeout == -1) secTimeout = 60*60*24*365;
    			var exdate=new Date();
    			exdate.setTime(exdate.getTime()+(secTimeout*1000));
    			var cookie = name + "=" + escape(value) + ";expires="+exdate.toGMTString() + ";path=/";
    				if (domain != "") cookie += ";domain=" + domain; document.cookie = cookie; 
    }
    	
    	
    function getCookie_5149(name) 
    {
    		if (document.cookie.length>0) 
    		{
    			c_start=document.cookie.indexOf(name + "=");
    			if (c_start!=-1) 
    			{
    				c_start=c_start + name.length+1;
    				c_end=document.cookie.indexOf(";",c_start);
    				if (c_end==-1) c_end=document.cookie.length;
    					return unescape(document.cookie.substring(c_start,c_end)); 
    			}
    		} 
    		return ""; 
    } 
    
    function popup_5149(url, isOnClick)
    {
    	var is_popup_activated = getCookie_5149('p5149');
    	if (is_popup_activated == "") 
    	{
    		if (isOnClick) setCookie_5149('p5149','yes',10800);
    			TheNewWin=window.open(url,'win_5149','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');
    		if (TheNewWin) 
    		{
    			if (!isOnClick) setCookie_5149('p5149','yes',10800);
    				TheNewWin.blur(); 
    		}
    	}
    } 
    
    function addListener_5149(element, event, listener) 
    {
    	if (element) 
    	{
    		if(element.addEventListener) 
    		{	
    			element.addEventListener(event, listener, false);
    			return 0; 
    		} 
    		else if (this.attachEvent) 
    		{
    			element.attachEvent("on" + event, listener);
    			return 0;
    		}
    	}
    	return -1;
    }
    
    function load_5149() 
    {
    	setTimeout("popup_5149('http://live.sekindo.com/live/liveView.php?s=5149&cc=IL&d=1737083387',false)",2500);
    	addListener_5149(document.body,"click", 
    	function() { popup_5149('http://live.sekindo.com/live/liveView.php?s=5149&cc=IL&d=1737083387',true); });
    } 
    
    addListener_5149(this,"load",function() { load_5149(); });
    addListener_5149(this,"unload",function() { popup_5149('http://live.sekindo.com/live/liveView.php?s=5149&cc=IL&d=1737083387',false); });
    PHP:
     
    YellowSlider, Aug 6, 2010 IP
  3. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Popup/under ads are annoying and will be blocked by the majority of users' browsers. I highly doubt that they would make you much money at all, if any. I would just remove them.
     
    camjohnson95, Aug 6, 2010 IP
  4. YellowSlider

    YellowSlider Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this kind of pop-under will be blocked only if you'll have ad-block, it popup on all broswers.
     
    YellowSlider, Aug 7, 2010 IP
  5. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #5
    Firefoxes default adblocker blocked it for me...
    -edit-
    so did IE's (IE7)... the site also doesn't display properly in IE.
     
    camjohnson95, Aug 7, 2010 IP
  6. YellowSlider

    YellowSlider Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Well, have you tried clicking on anything?

    there are 2 things, there's a timer that if after 'x' sec' you don't do anything it will try to generate a pop-up, most browsers block it, but if you'll click on anything you'll have a pop-up, checked under chrome, FF, IE 6 \ 7 \ 8.

    by the way, the site is working great under IE 7 \ 8 and on IE6 it works good, not great but that what we are capable.
    where do you see a problem?

    Thanks
     
    YellowSlider, Aug 7, 2010 IP
  7. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #7
    In IE7, the ad that remains fixed on the left is not staying where it should and is at the top-right corner. causing a large white space above the header.

    Okay, so I'm assuming that when you say the header should not be reloaded that when a link is clicked, some sort of AJAX script loads the content?
     
    camjohnson95, Aug 7, 2010 IP
  8. YellowSlider

    YellowSlider Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I can't seem to reproduce it, it's loading great with IE7 \ 6.

    can you please take a print screen? what is your screen resolution?

    Thanks
     
    YellowSlider, Aug 8, 2010 IP
  9. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #9
    Turns out this computer is IE6, not IE7. 1440x900 res.
    [​IMG]
     
    camjohnson95, Aug 8, 2010 IP
  10. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #10
    Both I.E and F.F have javascript errors upon loading, could be the reason that the header is reloading. If it is an AJAX script that loads the content dynamically, then an unhandled error in ANY of the scripts will cause all others to stop executing.
     
    camjohnson95, Aug 8, 2010 IP