Search code examples
javascriptjqueryhtmlhtml5-filesystemarraybuffer

DOM Exception on filesystem url sharing via window messaging?


I have to share dynamic generated content file URL to the iframe. I am getting DOM Exception 12 while passing URL to iframe.

var iframe = document.getElementById('vwr-frame').contentWindow;
iframe.postMessage({Url:url }); //URL is filesystem URL

do I need to specify bufferType or is it possible to send url?


Solution

  • You need to send targetOrigin, it is not an optional parameter. Passing "*" may be enough.

    otherWindow.postMessage(message, targetOrigin);
    //                                     ^
    

    The MDN page for window.postMessage has more information.