I am trying to find the DOM iframe
or frame
element for each of the frames in a window's frames
collection. The fastest way to do this, I think, is to access the frame's frameElement
property. This property is only available for a same-domain access, and returns undefined and prints an error message to the log in the cross-domain case.
I can loop through the elements returned from document.getElementsByTagName
to find the correct element in the cross-domain case, but I'd like to avoid printing the "Unsafe JavaScript attempt" message to the log.
Is there any way to tell before trying it if a property access attempt will run afoul of the cross-domain security policy?
Thanks.