I am emulating a modal window functionality on my HTML5 page by creating a div with position: fixed
, centered in the browser window etc. In some cases my modal window just shows a message with one or more buttons, such as OK
Cancel
, but in other cases I'm showing more complicated forms, e.g. an instant messaging dialog.
The question is for the more complicated cases. So which is better, (1) to have an <iframe>
in my "modal" window or (2) a <div>
plus some Ajax code that retrieves the contents of my form and injects it into the div's innerHTML?
What are some caveats in either case? When you choose one over the other, what is your reasoning?
Browser requirements: IE9+ and the rest of the sane browsers.