What is the meaning of window.postMessage1?

What do you mean by

window.postMessage.accountability1? I print out window.postMessage.length always = 2

Apr.09,2021

window.postMessage is a function.

length is an attribute value of the function object, indicating how many parameters the function must pass in, that is, the number of formal parameters.

does not include . parameters, or parameters with default values. Function.prototype.length document

window.postMessage signature (where transfer is an optional parameter):

otherWindow.postMessage (message, targetOrigin, [transfer])

window.postMessage document


in fact, the number of formal parameters varies from browser to browser. Today you encounter a pit

  • the number of formal parameters of chrome and Firefox is 1
  • 360Quick is 2 (yes, it is webkit with a lot of skin)
  • edge is 0

so, use this property with caution

Menu