Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.0k views
in Technique[技术] by (71.8m points)

js页面跳转的思路

现在有个这样的需求:A页面通过一个a标签打开了B页面,现在想通过操作B页面让A页面实现跳转。请问有没有好的思路呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

楼主的需求,基本上有两种做法。
1,按照楼上说的通过 window.opener 可以拿到打开当前页面的对象。https://wiki.developer.mozill...

2,通过数据操作,客户端请求来完成。进行类似消息接收的流程

a -> window.open(someTarget)
b -> 某个操作后向服务器发送一条推送,ID69B53 须要跳转到 http://www.baidu.com
a -> 接收到跳转协议,执行跳转(跳转参数是 b 传递的数据)

a 须要定时轮询接口 or websocket 或其它技术接收信息
b 要产生发送的信息

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...