Suppose i have some tabs (e.g. jquery tab) and I want to dynamically load some page in each tab, I can do that in two ways
- Use jquery ajax tabs (basically filling div with ajax data)
or - Each tab can contain an iframe and page loaded into that.
Q1. I see no difference between two approaches to user, is there?
Q2. I think iframe way is better because iframe can load any page but sometimes loading ajax data into div may not work as expected.
For one, having an error in an included page (or ajax call) is probably better to handle with the ajax approach. With iframes you’ll just get an ugly 404 or 500 error in the middle of your page. But with ajax you can detect the error and display a more user-friendly error message.
It also depends on what data you’re loading into your page. If you control the html being loaded in, you can avoid or fix any display issues that may arise. If you need to load a page outside of your control, iframes would be best (or necessary).
There may also be accessibility issues involved with either approach, but I’m not familiar enough with that to determine which approach works best with screen readers, etc.