AnsweredAssumed Answered

receiver.postMessage('Hello Kid!', '*'); window.parent.postMessage("Hello parent", '*');

Question asked by M_skovborg on Apr 9, 2014
Latest reply on Apr 9, 2014 by dlender

Hi I'am trying to get the postMessage to work in Finesse, with no luck

I have created a XML doc like this:

---SNIP----

<fieldset id="userfieldset" class="outline">

           <div>1916</div>

            <p>

            <div id="message"></div>

          </p>

           <br>

         <button id="send">Send Message</button>

         </p>

          <iframe id="receiver" src="http://myWebserver/finesse/SimpelHTML/receiver.html" width="100%" height="800">

              <p>Your browser does not support iframes.</p>

          </iframe>

----SNIP----

 

And a JS like this:

 

----SNIP----

// A function to handle sending messages.

    function sendMessage(e) {

        // Prevent any default browser behaviour.

        e.preventDefault();

 

        // Send a message with the text 'Hello Kid!' to the receiver window.

        receiver.postMessage('Hello Kid!', 'http://mywebserver/');

    }

 

    function receiveMessage(e) {

        // Check to make sure that this message came from the correct domain.

        //if (e.origin !== "http://s.codepen.io")

        //return;

 

        // Update the div element to display the message.

        messageEle.innerHTML = "Message Received: " + e.data;

    }

---SNIP----

 

It works when I use it outside Finesse, but not in Finesse.

 

Please advise

Br,

Morten Skovborg

Outcomes