Cannot send information to dialog box- Outlook Add-in

HA 1 Reputation point
2021-10-26T10:37:12.647+00:00

Hello, I cannot send information to my dialogbox in my Outlook add-in. Here is the Javascript code in the parent:

 var url2 = window.location.origin+'/dialogbox.html'
 var dialog
 Office.context.ui.displayDialogAsync(url2, {height: 50, width: 50},
          function (asyncResult) {
              dialog.messageChild('hello from the parent', {targetOrigin: "*" })     
          });

And here us the Javascript in the child dialog box:

Office.onReady().then(function() {
        Office.context.ui.addHandlerAsync(
            Office.EventType.DialogParentMessageReceived,
            onMessageFromParent);
    });

function onMessageFromParent(arg){
    console.log(arg.message)
}

However, the message 'hello from the parent' is not printed in the console.

Instead I get the following in the console:

Tracking Prevention blocked access to storage for https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js. [https://localhost:3000/commands.html?_host_Info=Outlook$Win32$16.02$en-US$$$$0]

What am I doing wrong? How can I pass the message to the dialog box?

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,517 questions
0 comments No comments
{count} votes