问题
What is the current modern alternative to frames?
I want to build the equivilant of a two frame website, with the top frame containing elements that DO NOT RELOAD, the the bottom "frame" being the content frame, which reloads as needed.
回答1:
You can do this with AJAX. You load content dynamically as it's needed. Your content area need not even have size limits - as the user scrolls down the page you can load additional content automatically underneath what was already loaded.
回答2:
You can use server-side languages like PHP and ASP.Net, but if you don't want the header to reload, then AJAX is the way to go.
Using jQuery lib:
$.ajax({
url: "foo.html",
context: document.body,
success: function(){
alert("Done!");
}
});
回答3:
You're describing a single page application. See Steve Sanderson's presentation and blog posts - http://blog.stevensanderson.com/2012/03/06/single-page-application-packages-and-samples/
He's using ASP.NET, but the concepts are the same for other server side technologies.
来源:https://stackoverflow.com/questions/9609977/modern-day-alternative-to-frames