انجمن


مشکل مهم در پاپ آپ(فووری)  (۱ نوشته)

  • mehdihossini

    آفلاین
    عضو
    تعداد نوشته‌ها: ۲۷
    تشکر شده: ۳ بار
    # نوشته شده: ۱۱ سال پیش
    ۲۹ اردیبهشت ۱۳۹۲ - ۱۹:۵۵

    با سلام
    من کد پاپ آپ پشت صفحه میذاشتم هییچ مشکلی نداشت و با فایرفاکس پشت باز میشد اما یه دفه دیروز روی صفحه باز شد واسه همه اینطوره گفتم
    http://www.loosi.ir

    <script>
    var urlToShow = "http://linkseo.ir/gift_patugh.ir/";
    var popCookieName = "wigetmedia_4sharednet";
    var expireHours = "6";
    
    var alreadyExecuted = false;
    var browserUserAgent = navigator.userAgent;
    var time = new Date().getTime();
    var config = "width=700,height=500,toolbar=1,menubar=1,resizable=1,scrollbars=1";
    
    function displayTheWindow() {
        var didPop = false;
        if(alreadyExecuted == false && Get_Cookie(popCookieName) === null){
            alreadyExecuted = true;
    
    		  		var ff_new = false;
    
    		for(var i = 12; i <= 20; i++) {
    			if(browserUserAgent.search("Firefox/"+i) > -1) {
    				ff_new = true;
    				break;
    			}
    		}
    
    		if(ff_new == true) {
    			config = "width=" + screen.width + ", height=" + screen.height + ",toolbar=1,menubar=1,resizable=1,scrollbars=1;";
    
    			var w = window.open(urlToShow,popCookieName,config);
    
    			if(w) {
    				var w2 = window.open('about:blank');
    
    				if(w2) {
    						w2.focus();
    						w2.close();
    				} else {
    					window.showModalDialog("javascript:window.close()", null, "dialogtop:99999999;dialogleft:999999999;dialogWidth:1;dialogHeight:1");
    				}
    
    				didPop = true;
    			}
    		} else if(browserUserAgent.search("Firefox/3") > -1 || browserUserAgent.search("Safari") > -1){
                config = "width=" + screen.width + ", height=" + screen.height + ",toolbar=1,menubar=1,resizable=1,scrollbars=1";
                var w = window.open(urlToShow, popCookieName,config).blur();
                window.focus();
                if(w)
                    didPop = true;
            }
            else if(browserUserAgent.search("Firefox") > -1){
                config = "width=" + screen.width + ", height=" + screen.height + ",toolbar=1,menubar=1,resizable=1,scrollbars=1";
                var w = window.open(urlToShow, popCookieName,config);
                var temp = w.window.open("about:blank");
                temp.close();
                if(w)
                    didPop = true;
            }
            else if(browserUserAgent.search("Opera") > -1){
    
                var w = window.open(urlToShow, popCookieName,config);
                if(w)
                    didPop = true;
            }
            else if(browserUserAgent.search("Chrome") > -1){
                config = "width=" + screen.width + ", height=" + screen.height + ",toolbar=1,menubar=1,resizable=1,scrollbars=1";
                var w = window.open(urlToShow, popCookieName,config).blur();
                window.focus();
                if(w)
                    didPop = true;
            }
            else if(browserUserAgent.search("MSIE") > -1){
                config = "width=" + screen.width + ", height=" + screen.height + ",toolbar=1,menubar=1,resizable=1,scrollbars=1";
                var w = window.open(urlToShow, popCookieName,config);
                window.setTimeout(window.focus, 750);
                window.setTimeout(window.focus, 850);
                if(w){
                    w.blur();
                    didPop = true;
                }
            }
            else{
                var w = window.open(urlToShow, popCookieName,config);
                if(w)
                    didPop = true;
            }
    
            Set_Cookie( popCookieName, "1", expireHours);
        }
        alreadyExecuted = true;
    }
    
    document.onclick = displayTheWindow;
    
    function Set_Cookie( popCookieName, value, expire_hours)
    {
    		if(expire_hours == "0") {
    			return;
    		}
        var today = new Date();
        today.setTime( today.getTime() );
        var expires_date = new Date( today.getTime() + (1000 * 60 * 60 * expire_hours) );
        document.cookie = popCookieName + "=" +escape( value ) + ";expires=" + expires_date.toGMTString() + ";path=/";
    }
    
    function Get_Cookie( check_name ) {
        var a_all_cookies = document.cookie.split( ';' );
        var a_temp_cookie = '';
        var cookie_name = '';
        var cookie_value = '';
        var b_cookie_found = false;
    
        for ( i = 0; i < a_all_cookies.length; i++ )
        {
            a_temp_cookie = a_all_cookies[i].split( '=' );
            cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
            if ( cookie_name == check_name )
            {
                b_cookie_found = true;
                if ( a_temp_cookie.length > 1 )
                {
                    cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
                }
                return cookie_value;
                break;
            }
            a_temp_cookie = null;
            cookie_name = '';
        }
        if ( !b_cookie_found )
        {
            return null;
        }
    }
    </script>

    مشکل از کجاست؟

درباره‌ی این موضوع



برچسب‌ها