Support pour les iframes
Envoyer une commande
{
__tcfapiCall: {
command: *command*, // name of the command to execute
version: 2, // version of the TCF specification
parameter: *parameter*, // parameter to be passed to the command function
callId: *uniqueId* // unique call ID
}
}this.callId = this.callId || 0;
var message = {
__tcfapiCall: {
command: 'addEventListener',
version: 2,
parameter: null,
callId: ++this.callId
}
};
window.top.postMessage(message, '*');Récupérer le résultat de la commande
function processMessage(event) {
if (event && event.data && event.data.__tcfapiReturn && event.data.__tcfapiReturn.success) {
console.log(event.data.__tcfapiReturn.returnValue);
}
}
window.addEventListener('message', processMessage);Mis à jour
Ce contenu vous a-t-il été utile ?
