JS implementation open the Web page automatically pop-up add QQ Friends Invitation window

Source: Internet
Author: User

First step, JS script

This is more critical, we need to create a new Pop.js script file, we can also add the following code to the site's existing JS file.

The code is as follows Copy Code

var qq_chat = true;
function Playjsadpopwin () {
if (qq_chat) {
Popwin = Window.location.href = ' tencent://message/?uin= our QQ number &site= website name &menu=yes '
SetTimeout ("Playjsadpopwin ()", 1000);

The corresponding UIn and site parameters can be modified to their own. For the pop-up time, you can adjust the 1000 parameters after settimeout, the larger the number the slower the pop-up.

Step two, add to the page

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

The code is as follows Copy Code

<script type= "Text/javascript" src= "Pop.js" ></script>

And what is the page we open?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.