Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

如何让a标签打开的页面为全屏?

如何让a标签打开的页面为全屏?

换了种思路,大致实现了想要的效果了

通过$.ajax加$(ele).html()实现,
只须让ele全屏即可

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

1 Reply

0 votes
by (71.8m points)

直接打开就全屏是做不到的,现代浏览器是不会暴露这样的方法的,会引起极不舒适的用户体验。
一般来说必须得有用户操作才能做到全屏,如使用Element.requestFullscreen()方法,前提是在用户交互事件中使用这个方法。
而在ie7或更早版本中或许可以通过window.open(src, 'newWin', 'fullscreen="yes"')来全屏打开。
MDN 明确表明不行

How do I force a maximized window?
You cannot. All browser manufacturers try to make the opening of new secondary windows noticed by users and noticeable by users to avoid confusion, to avoid disorienting users.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...