您的位置:首页 > 数码常识数码常识
Jquery、Javascript页面跳转路径错误问题(js中跳转相对路径的方式)
2025-05-15人已围观
Jquery、Javascript页面跳转路径错误问题(js中跳转相对路径的方式)
1.使用Jquery实现跳转
js中跳转相对路径的方式
$(location).attr('href',"http://");$jq(window).attr("location","http://");$(location).prop('href',"http://");
2.使用JavaScript实现跳转
// 相当于 HTTP redirectwindow.location.replace("http://stackoverflow.com");// 相当于 clicking on a linkwindow.location.href="http://stackoverflow.com";
JavaScript其它的可实现页面跳转的方式
window.history.back(-1);window.navigate("top.jsp"); //old-ie-onlyself.location='top.jsp';top.location='top.jsp';window.location=window.locaiton.host;winodw.locaiton.assign('http://');ducument.location.href='http://sjzlt.cn/path';window.history.go(-1);
3.页面跳转路径错误问题
ie8以下的页面跳转需要使用绝对路径,使用相对路径的时候ie会自动网跳转的Url上面加上当前页面的路径,这会导致跳转错误。 下面是解决办法:
function Redirect (url) { var ua=navigator.userAgent.toLowerCase(),
上面就是小居数码小编今天给大家介绍的关于(js中跳转相对路径的方式)的全部内容,希望可以帮助到你,想了解更多关于数码知识的问题,欢迎关注我们,并收藏,转发,分享。
94%的朋友还想知道的:
cad丢失文件怎么找回来(cad自动保存的文件路径找不到)
js的跳转页面代码(js的跳转页面)
oracle数据存放路径(linuxoracle配置文件位置)
linuxyum安装软件默认路径(yum查看安装路径)
154680
1.使用Jquery实现跳转
js中跳转相对路径的方式
$(location).attr('href',"http://");$jq(window).attr("location","http://");$(location).prop('href',"http://");
2.使用JavaScript实现跳转
// 相当于 HTTP redirectwindow.location.replace("http://stackoverflow.com");// 相当于 clicking on a linkwindow.location.href="http://stackoverflow.com";
JavaScript其它的可实现页面跳转的方式
window.history.back(-1);window.navigate("top.jsp"); //old-ie-onlyself.location='top.jsp';top.location='top.jsp';window.location=window.locaiton.host;winodw.locaiton.assign('http://');ducument.location.href='http://sjzlt.cn/path';window.history.go(-1);
3.页面跳转路径错误问题
ie8以下的页面跳转需要使用绝对路径,使用相对路径的时候ie会自动网跳转的Url上面加上当前页面的路径,这会导致跳转错误。 下面是解决办法:
function Redirect (url) { var ua=navigator.userAgent.toLowerCase(),
上面就是小居数码小编今天给大家介绍的关于(js中跳转相对路径的方式)的全部内容,希望可以帮助到你,想了解更多关于数码知识的问题,欢迎关注我们,并收藏,转发,分享。
94%的朋友还想知道的:
cad丢失文件怎么找回来(cad自动保存的文件路径找不到)
js的跳转页面代码(js的跳转页面)
oracle数据存放路径(linuxoracle配置文件位置)
linuxyum安装软件默认路径(yum查看安装路径)
154680
很赞哦! ()