js realize open the Web page automatically pop up window to add QQ friends invited

We sometimes into some of the webs or topic page will automatically pop up a dialog box add as a friend, and after a long study found that can be used to achieve js directly, let's look together to achieve js open the Web page automatically pop up window to add QQ friends invited Methods.

The first method: JS script (recommended, no framework conducive to optimizing)

This is more critical, we need to create a pop.js script file, we can put the following code into an existing site JS file.

to true qq_chat = var;
function show_qq () {
IF (qq_chat) {
popwin = window.location.href = 'Tencent:? // Message / UIN = QQ number is set & Site = Name = Yes disposed Menu &'
}
};
the setTimeout ( "show_qq ()", 1000) ;

Site uin and corresponding parameters can be modified to your own. For pop-up time can be adjusted in the back of the setTimeout parameter 1000, the larger the number, the slower pop.

If the above script in our existing website page JS, this time we can directly pop-up effect. If we are the new JS file, we need to add POP.JS to the page.

<script type="text/javascript" src="pop.js"></script>

Set up multiple customer service QQ

For enterprises have multiple customer service, the customer directly to the rational allocation of hospitality. Just also developed a set of solutions is preset multiple customer service QQ, and then give visitors a random pop-up dialog box customer service QQ! This course is suitable for business, for individual owners is not necessary.

<iframe style="display:none;" class="qq_iframe" src=""></iframe>
<script>
$(function(){
    qq_list = new Array('12345678', '87654321');
    //random
    qq_i = Math.floor(Math.random()*qq_list.length);
    src = "tencent://message/?uin="+qq_list[qq_i]+"&Site=&menu=yes";
    $('.qq_iframe').attr('src',src);
})
</script>

Delay pop-up dialog

There are a lot of customers ask me how to set the visitors 10 seconds to open the page and then pop up, pop up again updated this study, the method does find may set 10 seconds after the pop-up! This can improve the user experience to a certain extent, while allowing visitors to look at the service site can effectively enhance the customer acceptance of the product, thereby enhancing opportunities for customers to take the initiative to communicate!

<iframe style="display:none;" class="qq_iframe" src=""></iframe>
<script>
$(function(){
    setTimeout(function(){
        qq_list = new Array('12345678', '87654321');
        //random
        qq_i = Math.floor(Math.random()*qq_list.length);
        src = "tencent://message/?uin="+qq_list[qq_i]+"&Site=&menu=yes";
        $('.qq_iframe').attr('src', src);
    }, 10000)
})
</script>

The second method: Framework

1, the frame is inserted iframe on the page and set the src = "tencent:? // message / uin = QQ number is set & amp; Site = Company Name setting & amp; menu = yes";

2, visitors to the site will be open at the same time you open links iframe framework;

3, visitors will QQ chat window with your QQ dialog box pops up.

Specific code as follows:

<Iframe src = '? Tencent: // message / uin = QQ number is set & amp; Site = Company Name setting & amp; menu = yes' width = '0' height = '0' marginwidth = '0' marginheight = '0' scrolling = 'no'> </ iframe>

<Iframe style = "display: none;" src = "tencent:? // message / uin = QQ number is set & Site = company name setting & menu = yes"> </ iframe>



Guess you like

Origin www.cnblogs.com/jxhgt/p/11096342.html