Fw.qq.com/ipaddress expired JavaScript A new method for obtaining client IP _javascript tips

Source: Internet
Author: User
Tags get ip
We call it the <script type= "Text/javascript" src= "http://fw.qq.com/ipaddress" ></script>. It can return user IP and address, such as: var ipdata = new Array ("220.181.108.85", "", "Beijing", ""); We can use Ipdata[0] as a user IP.

But recently did not know what is going on Tencent, this address is invalid, prompted "HTTP 500 Internal server error."

Another way for JavaScript to get client IP

Recently, I found another way to get the client IP, the service is provided by a foreign website. Use the following methods:
<script language= "JavaScript" > Vih_backcolor = "Palegreen"; Vih_forecolor = "Navy"; Vih_fontpix = "16"; Vih_displayformat = "You are visiting From:ip address:%%ip%% Host:%%host%%"; Vih_displayonpage = "Yes"; </script> <script language= "JavaScript" src= "http://www.hashemian.com/js/visitorIP.js.php" ></ Script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Your IP is shown below:

You are are visiting from:
IP address:117.87.4.102
host:102.4.87.117.broad.xz.js.dynamic.163data.com.cn


If you do not want to display on the Web page, just want to get IP, for other purposes, then you need to change vih_displayonpage = "Yes" to Vih_displayonpage = "no". The IP variable is vih_hostip. The method is invoked as follows:
<script language= "JavaScript" > vih_displayonpage = "no"; </script> <script language= "JavaScript" src= "http://scripts.hashemian.com/js/visitorIPHOST.js.php" > </script> <script language= "JavaScript" > Alert ("Your IP is:" + vih_hostip); </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Related Article

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.