我在页面上有2个iframe,我正在尝试使用postMessage将DOM元素从一个iframe传递到另一个iframe.但铬一直给我错误:
“DataCloneError: An object could not be cloned. “
有没有解决这个问题的方法?
最佳答案
根据
spec,你不能发送DOM节点,它会抛出一个
错误.
Messages can be structured objects,e.g. nested objects and arrays,can contain JavaScript values (strings,numbers,Date objects,etc),and can contain certain data objects such as File Blob,FileList,and ArrayBuffer objects.