我有一個問題,這個code.I要重定向我的桌面用戶block.php頁面,不要讓他們進來。重定向桌面用戶到另一個網頁和移動用戶主頁
我測試了很多的代碼和非他們爲我工作。
此刻,我發現這code.its作品完美...但有一個小問題。
當我檢查我的手機(iOS設備)的網站。它保持重裝
這是代碼:
<script>
if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i)) {
window.location.assign("http://example.com");
} else {
window.location.assign("http://example.com/block.php");
}
</script>
是什麼問題?
你有嘗試的.htaccess? – keronconk
@keronconk no..i想使用JS ...但是它如何與.htaccess? –