All Safari browsers, all Firefox browsers (and for that matter all
Gecko derived browsers) and opera versions from (at least) 6 on, are
"21st century browsers".
Neither.
The src property is only used to set the initial url of the Iframe.
Taking the question literally that is exactly what the OP asks to do.
The questionable sense in attempting that justifies dismissing it.
However, as the - src - property is specified in the W3C HTML DOM
standard and is not read only, if you wanted to set it then writing a
new value to the property of the IFRAME element object should be
acceptable (even if there are no technical reasons for expecting that
action to have useful consequences).
To set a new URL you use the iframes contentWindow
'iframeObj.contentWindow.location = foo;'
In the W3C HTML level 2 DOM standard the HTMLIFrameElement interface
does not have a - contentWidnow - property, only- contentDocument -.
Though I think all of the listed sub-set of "21st century browsers" do
have that property.
However, assigning to the - location - property of a window/frame
object is OK for windows/frames containing HTML documents (and some
other sorts) but I don't think you will find the property in, say,
window/frame objects that contain PDF document. Obviously that is not
an issue if the intention is never to attempt to navigate the frame to
any non-HTML documents.
The most general, cross-browser, method of navigating any frame
(including an IFRAME) with scripts is to arrange that the frame has
both ID and NAME attributes that hold the same value and then access
its window/frame object through the - frames - collection of the
containing window/frame object, using that NAME/ID i.e.:-
frames['exampleFrameName'].location = 'new URL';
or (if you like):-
window.frames['exampleFrameName'].location = 'new URL';
And that formulation has been effective on every browser that has
supported both javascript and frames/iframes (including those that do
not have - contentWindow - properties and those were assigning the to
- src - property of an IFRAME element did not result in navigation).
It is one of the very few 'one code fits all' browser scripting
options.
(Note, this is not using - document.frames - as that was never
universally supported in frame capable browsers, and that the use of
the - location - property imposes the same caveats for (at least some)
non-HTML documents as your suggestion.)
Richard.