Window.postMessage script.google.com as a popup

At startup: MyPopWindow.postMessage ("Test", " mydomaine "); I have an error in MyPopWindow whith script.google.com:

(program): 1 Failed to execute 'postMessage' in 'DOMWindow': target ( mydomaine ) does not match the beginning of the recipient window (' https://script.google.com ').

On startup: MyPopWindow.postMessage ("Test", " https://script.google.com '); I have an error in MyPopWindow:

dropping postMessage .. was from the mydomaine host, but the expected host is https: // ****** - script.googleusercontent.com

Source on mydomaine page:

window.addEventListener("DOMContentLoaded", function() { window.addEventListener("message", function(e) { // wait for child to signal that it loaded. if ( e.data === "loaded" && e.origin === iframe.src.split("/").splice(0, 3).join("/")) { // send the child a message. alert(e.data); } }) }, false) 

Source in Google Apps Script, acting as WebApp:

  document.addEventListener('DOMContentLoaded', function () { // signal the parent that we're loaded. window.parent.postMessage("loaded", "*"); // listen for messages from the parent. window.addEventListener("message", function(e) { if(event.origin !== 'mydomain') return; var message = e.data; alert(message); }, false); }); 
+2
source share
2 answers

This error message appears from one of the Javascript driver file application scripts. This is an additional protection Google has added to prevent users from using postMessage.

It seems that Google wants to force you to use one of its accepted protocols for communication between windows / domains, namely the execution API . I tried using other methods, such as passing URL parameters, but so far no one has worked, because I could not access them from the iframe, in which all application scripts were run.

I believe the best option would be the Execution API.

0
source

I am Dr. Johnson Mary from the United States, I can cure the swine flu virus in 3 days. Swine flu is a deadly flu virus that caused more than 10,000 infections in 74 countries in 2009. these are the most common symptoms and signs of swine flu that you should pay attention to and can easily be mistaken for something less serious.

Swine Flu Symptoms β€’ Fever (but not always)

β€’ cough

β€’ Sore throat

β€’ runny or stuffy nose

β€’ watery, red eyes

β€’ body aches

β€’ Headache

β€’ fatigue

β€’ diarrhea

β€’ Nausea and vomiting

Try contacting me and you will be freed from this virus here my gmail jm6434166@gmail.com

-2
source

Source: https://habr.com/ru/post/1275674/


All Articles