Home >Web Front-end >H5 Tutorial >Two solutions to why HTML5 does not support frameset
The solution is as follows:
The first one
uses iframe, but currently fewer and fewer people use iframe. Moreover, iframes are incompatible between different browsers. And some of my R&D personnel said that transferring values between iframe windows seems troublesome.
Second option
Use jQuery's onload method to load the page. However, after this method jumps to multiple pages, clicking the back and forward button above the browser is invalid. , but you can think of adding a back button.
So personally I prefer this method.
I usually write like this
$("#main").load("mainIndex.html",function(){ });
For pages, p+css can achieve the effect of frame
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>p+css实现frameset效果</title> <style type="text/css"> .header{border-bottom:1px solid #ccc;margin-bottom:5px;} .MainContainer{min-width:960px;max-width:1600px;} .sidebar{width:180px;float:left;margin-right:-180px;border-right:1px solid #ccc;min-height:500px;padding:5px;} .main{float:left;margin-left:200px;padding:5px;} .content{padding:0 10px;} </style> </head> <body> <p class="page"> <p class="header"> <p id="title"> <h1>顶部</h1> </p> </p> <p class="MainContainer"> <p class="sidebar"> 边栏 </p> <p id="main" class="main"> 内容 </p> </p> </p> </body> </html>
Summary
The above are the two solutions for HTML5 not supporting frameset, more related Please pay attention to the PHP Chinese website (www.php.cn) for content!