farbodpoles
دوشنبه 24 آذر 1393, 12:06 عصر
سلام
یه کد پاپ اپ دارم که همه چیش خوب کار می کنه. فقط در مرورگر کروم و مرورگر موبایل و اکسپلور وقتی کلیک میشه یک صفحه در نیو تب باز میشه و وقتی کاربر بر می گرده تو سایت با یه کلیک دیگه دوباره یه صفحه نیوتب باز میشه می خوام هر دو صفحه پاپ اپ با اولین کلیک پشت صفحه باز بشه. توی مرورگز فایرفاکس همین طور باز میشه ...
مشکلش چیه؟
<script>
<?php if(is_single()) { ?>
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{
return unescape(y);
}
}
}
function setCookie(c_name,value)
{
var exdays= 12;
var exdate=new Date();
exdate.setHours(exdate.getHours(1) + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function checkCookie()
{
var username1=getCookie("tabligh1");
var username2=getCookie("tabligh2");
var username3=getCookie("tabligh3");
var username4=getCookie("tabligh4");
var username5=getCookie("tabligh5");
var usernam = "sendshod";
if(username1==null | username2==null | username3==null | username4==null | username5==null){
window.open('javascript:void(0)','_parent','toolba r=1,location=1,directories=1,status=1,menubar=1,sc rollbars=1,resizable=1');
window.focus();
}
if(username1=="" | username1==null){
if(window.open('http://site.com/','_blank','toolbar=1,location=1,directories=1,sta tus=1,menubar=1,scrollbars=1,resizable=1')){
window.focus();
setCookie("tabligh1",usernam);
}
}
if(username2=="" | username2==null){
if(window.open('http://site.com','_blank','toolbar=1,location=1,directori es=1,status=1,menubar=1,scrollbars=1,resizable=1') ){
window.focus();
setCookie("tabligh2",usernam);
}
}
}
document.onclick = checkCookie;
if ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined)) window.onload = checkCookie;
<?php } ?>
</script>
یه کد پاپ اپ دارم که همه چیش خوب کار می کنه. فقط در مرورگر کروم و مرورگر موبایل و اکسپلور وقتی کلیک میشه یک صفحه در نیو تب باز میشه و وقتی کاربر بر می گرده تو سایت با یه کلیک دیگه دوباره یه صفحه نیوتب باز میشه می خوام هر دو صفحه پاپ اپ با اولین کلیک پشت صفحه باز بشه. توی مرورگز فایرفاکس همین طور باز میشه ...
مشکلش چیه؟
<script>
<?php if(is_single()) { ?>
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{
return unescape(y);
}
}
}
function setCookie(c_name,value)
{
var exdays= 12;
var exdate=new Date();
exdate.setHours(exdate.getHours(1) + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function checkCookie()
{
var username1=getCookie("tabligh1");
var username2=getCookie("tabligh2");
var username3=getCookie("tabligh3");
var username4=getCookie("tabligh4");
var username5=getCookie("tabligh5");
var usernam = "sendshod";
if(username1==null | username2==null | username3==null | username4==null | username5==null){
window.open('javascript:void(0)','_parent','toolba r=1,location=1,directories=1,status=1,menubar=1,sc rollbars=1,resizable=1');
window.focus();
}
if(username1=="" | username1==null){
if(window.open('http://site.com/','_blank','toolbar=1,location=1,directories=1,sta tus=1,menubar=1,scrollbars=1,resizable=1')){
window.focus();
setCookie("tabligh1",usernam);
}
}
if(username2=="" | username2==null){
if(window.open('http://site.com','_blank','toolbar=1,location=1,directori es=1,status=1,menubar=1,scrollbars=1,resizable=1') ){
window.focus();
setCookie("tabligh2",usernam);
}
}
}
document.onclick = checkCookie;
if ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined)) window.onload = checkCookie;
<?php } ?>
</script>