Window is used in IE. location. if the href method redirects, the referer value will not be blank if the referer value is empty in tag a. The following shows the specific implementation Code recently, the company website needs to collect statistics on the pages on which users enter the registration page. In the beginning, it is simply obtained through $ _ SERVER ['HTTP _ referer'] (php) on the SERVER side. However, we found that many registered users do not have the referer value. Later, we checked that the referer value is blank if window. location. href is used for redirect in IE. The referer will not be empty if the redirection in the tag is used. Therefore, you can solve this IE problem through the code below:
Function gotoUrl (url) {if (document. all) {var gotoLink = document. createElement ('A'); gotoLink. href = url; document. body. appendChild (gotoLink); gotoLink. click ();} else window. location. href = url ;}
The principle is to create a tag, set the url address to jump to, and then trigger the click event.