Javascript – “Access is denied” JavaScript error when trying to access the document object of a programmatically-created