Home >Web Front-end >JS Tutorial >How to use JS to determine the current domain name and jump to the specified page
1. How to use JS to determine the current domain name and jump to the specified page
获取当前请求路径 var href = location.href ; if(href.indexOf("baidu")>-1){ //跳转 location.href = "http://baidu.com"; }
2.
Today a customer asked his website to enter two different domain names and then load them. Enter the headers of different web pages. Thinking about it, we can only load different CSS through JS judgment.
The code is as follows:
host = window.location.host;if (host=="www.028wz.net") { document.write("<style>")document.write(".head{ background: url(document.write("</style>")}
3. Different domain names output different results
8019067d09615e43c7904885b5246f0a if (window.location.href.indexOf("www.xt.com") > -1) { document.write("34ea6544322564608ed2b6317046f1d171821010b2043eaddf6d5fab180f769d介绍5db79b134e9f6b82c0b36e0489ee08edbed06894275b65c1ab86501b08a632eb"); } else if (window.location.href.indexOf("www.gzxt.com") > -1) { document.write("34ea6544322564608ed2b6317046f1d14bafb88b9960390bf003a7918743acc4介绍5db79b134e9f6b82c0b36e0489ee08edbed06894275b65c1ab86501b08a632eb"); } else if (window.location.href.indexOf("www.gzxt.com") > -1) { document.write("34ea6544322564608ed2b6317046f1d12c1b3831a17b8b264f8a5cbfe8152b4b介绍5db79b134e9f6b82c0b36e0489ee08edbed06894275b65c1ab86501b08a632eb"); } 2cacc6d41bbb37262a98f745aa00fbf0
The above is the detailed content of How to use JS to determine the current domain name and jump to the specified page. For more information, please follow other related articles on the PHP Chinese website!