Trying to send post requests to a parent page from JS by calling
function sendPostMessage(message) {
console.log("sending post");
var post = { conf: message };
parent.postMessage(post, "*");
}
from c# as in
private void post_to_parent(string message)
{
Debug.WriteLine($"Sending post: {message}");
ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), $"sendPostMessage("{message}");", true);
}
But I get no response.
If I call the function from the same JS everything works fine.
If I call it from the C# function, I get the message in the debug console, but nothing in the JavaScript console. No message, nothing.
I am able to call other JS functions the same way and it works fine.
I am on an ASP.NET Web Form.