Background:
China Telecom Netcom's North-South splitting has become an unchangeable situation. As our website friends know, if we want to allow our friends in North and South regions to access our website smoothly, we need to buy dual-line servers, it is the line that connects both the Netcom user and the telecom user, although some data centers provide two IP Address (China Netcom and China Telecom have one IP At this time, we need to map a telecom address and a Netcom address during domain name ing, for example: Dianxin.xxx.com; wangtong.xxx.com; However, users always want to access Www.xxx.com In other words, we need to access Www.xxx.com When the user intelligently determines whether the user is in the north or south, and then jumps.
Ideas:
In www.xxx.com, let the client sendDianxin.xxx.comAndWangtong.xxx.comIf an incorrect request is sent, which address returns an incorrect response speed indicates the address that the user should access.
KeyCode:
Onerror = "location. Top. url = 'HTTP: // dianxin.xxx.com/'"/>
Onerror = "location. Top. url = 'HTTP: // wangtong.xxx.com/'"/>
In order for the user to directly jump to a faster line during the next visit, we can save the result of this judgmentCookie.
IMGOfOnerrorAnother application of the event:
We do not want users to see invalid images on our website. Even if an invalid image is displayed, we hope to tell users that the image is invalid in a friendly way, instead of showing users the default Red Cross directly. What should we do?OnerrorIn the eventSRCSet the property to an existing image on our website that does not exist.
Sample Code:
Onerror = "This. src = 'HTTP: // www.xxx.com/inv).gif'"/>
Note:
There are many solutions for north-south splitting. This article only provides you with one idea.