window.opener does not work in Excel for Windows - ms-office

I have built an Excel add-in, it opens a popup by window.open, then the add-in communicates with the popup site. I just realised that it does NOT work in Excel for Windows, the reason is that the popup can NOT get the host by $window.opener.
To illustrate this and avoid cross-domain, I have made a xml, which refers to the add-in and the test page. It works well in Excel Online in Chrome and in IE. However, while running it in Excel for Windows, $window.opener returns undefined.
Could anyone tell me what happened, and what's the workaround?
(for people who recommend Dialog API, please see this thread. So now neither Dialog nor window.open works in Excel for Windows).

UI.messageParent also won't work? It's from the official docs.
Example:
Office.context.ui.messageParent("Message from Dialog box")
Docs:
Delivers a message from the dialog box to its parent/opener page. The page calling this API must be on the same domain as the parent.
(I assume this isn't the Dialog API which you referring)

Related

Close open Desktop Taskpane using office.js or Add-in manifest function

We have created add-in manifest xml file for our application and also embed office.js file.
We have use custom ribbon feature by assigning url to icon. When we click on icon, it open task pane on desktop. We want to open third party url in new window of browser using Add-in manifest and taskpane should be close.
We have gone through AppDomains and uses Office.addin.hide function. But both solutions are not working.
Please provide us solution if exist.
Office.js doesn't provide anything for opening a new tab in a web browser. Instead, you can display a popup message. In Excel, you can use the following code to hide the task pane:
Office.addin.hide();
For example:
function onCurrentQuarterDeactivated() {
Office.addin.hide();
}
See Show or hide an Office Add-in in a shared runtime for more information.
You may try to use UI less function, in UI less function, you could execute a javascript code to open a page in the default browser.
You could refer to this answer.
Open directly a web page from a button in Ribbon in a browser outside Excel?

Outlook Addin window.open

I´m new to the addins, just want to perform a simple task as creating a button with a link in the taskbar that opens a browser and that´s it.
So far created the project based on ms tutorial and everything is working great (with fixed certificate problems).
To my understand this should be as easy as to create a button with an ExecuteFuncion actions mapping to a javascript function with a window.open
e.g.
function windowOpen(event)
{
window.open("https://www.microsoft.com");
event.completed();
}
Thanks for the help,
Regards,
André
For security reasons, Outlook does not support window.open directly inside of Add-ins. To open a window in an Outlook Add-in you can use the displayDialogAsync API (documentation here.) We recommend this guide to understand end-to-end usage of displaying a dialog in an Add-in.

Force Outlook Add-in popup to open with embedded browser

I'm seeing an issue with my Outlook Add-in (running in Outlook 2016) where when I open a popup window using window.open, it sometimes opens in the user's default browser (e.g. Chrome) instead of the browser running the add-in (e.g. the IE11 web view embedded in Outlook 2016). This is a problem because it prevents the popup window from communicating with the add-in, which is necessary for clickjacking protection.
Is there a way to force the popup window to be opened in the same browser that is running the add-in, without using the Dialog API? I would like to support requirement set 1.3.
You should check to see if the displayDialogAsync API exists. It was added in requirement set 1.4.
If it exists, we recommend using it. Please note that the dialog can only call the Office.context.ui.messageParent API. This API allows the dialog to communicate one-way with the add-in. The add-in can use those messages to leverage the Office.js APIs.
If the displayDialogAsync API doesn’t exist you can leverage window.open. However, in this case the default browser will not be launched.
As 2022 docs were updated.
The API documentation was moved from dev.office.com (these links don't work anymore) to learn.microsoft.com. And here you will find an example on how to use this api.

Control Windows Security popup when accessing a website via VBA Excel

Since an Excel file, I would like to connect that intranet of our company. My problem is that the login and the password are to be written in Windows Security popup.
I don't know how to manage that without using SendKeys... Another problem linked to that is that sometimes, the popup appears again, even if the login and password are good. Do youhave an idea to the way to catch such an event?
There is a solution with SendKeys. I lauch a script contained in a VBS file at the beginning of the macro. The script waits for the appearance a the popup and send the login/password in using SendKeys.

Communication between a webpage and Excel?

I am trying to find a way to make a web application communicate with Excel in the same way that a desktop application could talk to it using COM. The basic description of my problem is as follows:
User selects a cell within an Excel worksheet.
User switches focus to a web application running inside a browser and clicks a button.
The clicking of the button inside the web application causes a string to drop into the open Excel spreadsheet at the cell that was previously selected.
I should reiterate at this point that I am not trying to make a webpage generate an Excel file. Rather, I am trying to have the web application directly pass a message to the open instance of Excel.
This would be straightforward if I were writing a desktop application. But in the browser context, security is going to keep the web application from communicating with Excel. I understand that it might be possible to use an ActiveX control in IE to do this sort of thing, but I would prefer allow the application to run in any browser and ensure that the user does not have to modify their browser security settings.
Can anyone suggest a workaround? One thing I wondered about is whether you could use RTD to approach the problem. I have not used RTD, so I am unfamiliar with its exact capabilities. But if the user is logged into the web application, could their button click send a message to the server that is then relied back to the Excel instance using RTD? This assumes that the user also has an Excel plugin that provides their account credentials to the RTD server.
Thanks very much.
barrowc - The button is just there to communicate with Excel.

Resources