Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何重定向到jquery中的某个链接?_Jquery - Fatal编程技术网

如何重定向到jquery中的某个链接?

如何重定向到jquery中的某个链接?,jquery,Jquery,我试图在jquery中重定向到url,但它在同一页面上重定向,如 当我尝试重定向到此url-any.com 它重定向到 有什么想法吗?您应该使用window.location.href重定向为 var redirect_url = "http://any.com"; setTimeout(function(){ window.location.href = redirect_url; },2000); 如果您的重定向\u url没有http/https协议,您应

我试图在jquery中重定向到url,但它在同一页面上重定向,如 当我尝试重定向到此url-
any.com
它重定向到


有什么想法吗?

您应该使用
window.location.href
重定向为

var redirect_url = "http://any.com";
setTimeout(function(){
     window.location.href = redirect_url;
},2000);

如果您的
重定向\u url
没有
http/https
协议,您应该将其添加到重定向url中,而不仅仅是任何.com

您应该使用
window.location.href
将其重定向为

var redirect_url = "http://any.com";
setTimeout(function(){
     window.location.href = redirect_url;
},2000);

如果您的
重定向\u url
没有
http/https
协议,您应该将其添加到重定向url,因为您也可以尝试使用您的代码,您只错过了在url之前添加http://的功能

let redirect_url = 'http://www.page.com/any.com'
setTimeout(function(){
               window.open(redirect_url);
              },2000);

您也可以尝试使用您的代码,您错过的只是在url之前添加http://而已

let redirect_url = 'http://www.page.com/any.com'
setTimeout(function(){
               window.open(redirect_url);
              },2000);

与其回答重复的问题,不如将它们标记为重复的问题,这样做比回答新的问题更省力。不工作sirIt会将我重定向到。如果它没有正确重定向,但正在重定向,请说明。说“不工作”是完全没有用的。如果它指向错误的url,那么你传递了错误的url。与其回答重复的问题,不如将它们标记为重复的问题,这样做比新的答案更省力。不工作sirIt会将我重定向到,如果它没有正确重定向,但正在重定向,请说明。说“不工作”是完全没有用的。如果它指向错误的url,那么您传递的url是错误的。使用此选项可为新窗口重定向=>
window.open(重定向url,'.'U blank')使用它来重定向一个新窗口=>
window.open(重定向“url”,“空白”)