前端之页面跳转方法

 meta标签

<meta http-equiv="refresh" content="刷新时间; url=url">

a标签:

<a href="url" target='method'>链接文字</a>
  url:链接
  method:打开方式,
      打开方式:
        blank 新页面打开
        self 当前页面打开

iframe标签

<iframe src="url"></iframe>
    url:链接,html文件路径

layer.open

layer.open({
  type: 1, 
  content: '传入任意的文本或html' //这里content是一个普通的String
});

注意:使用前提是下载layer

window.open

window.open(URL,name)
   url:打开地址--可以是链接,或者html文件路径
   name:名称,或者是打开方式
        打开方式:
           _blank 打开新页面
           _self  当前页面打开


注意:ios可能会拦截

window.location.href

window.location.href='url' 本页面跳转
  url:跳转路径,链接或者html文件路径
    注意:html文件路径不要以'/'开头

window.self.location

window.self.location='url' 
  url:跳转路径,链接或者html文件路径
   

window.top.location

window.top.location='url' 
  url:跳转路径,链接或者html文件路径

window.location.replace

window.location.replace(url)
    url:跳转路径,链接或者html文件路径
注意:不保留历史记录

window.location.assign

window.location.assign(url)
    url:跳转路径,链接或者html文件路径
注意:保留历史记录
  

window.history.go

window.history.go(num)
     num:跳转页数,正数---前进几页
                  负数---后退几页                

window.history.back

window.history.back()后退一个页面
 

window.history.forward

window.history.forward()前进一个页面

  • 2
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序媛刘刘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值