AppDomains Not Working for Office (Word) Add-in in preventing domains from opening in new window on Mac - ms-word

I have something like the following in my Word Add-in
<AppDomains>
<AppDomain>https://google.com</AppDomain>
</AppDomains>
When navigating to google.com in my Word add-on on Mac it always opens in a new window.
In the browser it opens in the taskpane. Is this a bug, or am I doing something wrong?
AppDomains seems to work fine for Outlook Add-ons, as well as when I side-load the add-on on office.com
[1] https://learn.microsoft.com/en-us/office/dev/add-ins/reference/manifest/appdomain

Typing the full domain should work (i.e. add https://www.google.com to AppDomains) also I am assuming you are navigating using windows.location.href = "https://www.google.com"

Related

Firefox new-tab add-on showing extension url

I recently created a new tab add on with flutter. The add on works fine on Chrome. However, on Firefox there are 2 issues and this is one of them:
The address bar will display the add-on url like this:
moz-extension://c4c10ead-23ef-4aaa-8d33-7aa1f329ce9c/#/
I checked/installed other Firefox new tab add-on and their address bar remain empty.
This does not happen in Chrome either.
Anyone have clue why this happen? Or fix?
Firefox add-on: https://addons.mozilla.org/en-US/firefox/addon/pin2me/
Chrome add-on: https://chrome.google.com/webstore/detail/pin2me/hclokpdkmfceobbckckjkdohdgeljlld
Repo: https://github.com/J-Siu/pin2me
PS: There is one more issue but will open a new post.

How to diagnose failed validation of Word Add-In when it works on my own setup?

I'm developing an MS Word Add-In. I've tested it on both Windows and Mac, and it works fine for me. Microsoft requires its own validation of Add-Ins to make sure they work correctly, and my Add-In fails for them even though it works for me with the same version of Windows and Word.
I had a phone call with the Microsoft Validation team, and their only suggestion was that I post a question on Stack Overflow so here goes!
This is the version of Windows and Word that works for me but fails for the MS Validation team:
Windows 10 Pro OS build 18362.295
Word 2016 (Version 1908 in particular)
I submitted a very simple add-in to Microsoft for debugging purposes. This simple add-in has only a single button that just opens a web page in the user's default browser.
This is the relevant portion of the manifest:
<Control xsi:type="Button" id="PB.Home.Button">
<Label resid="PB.Home.Button.Label"/>
<Supertip>
<Title resid="PB.Home.Button.Title"/>
<Description resid="PB.Home.Button.Desc"/>
</Supertip>
<Icon> ... </Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>navigateToWebPage</FunctionName>
</Action>
</Control>
This is the entirety of FunctionFile.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js" type="text/javascript"></script>
<script src="FunctionFile.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
This is the entirety of FunctionFile.js:
(function () {
Office.initialize = function (reason) {};
})();
function navigateToWebPage(event) {
window.open('https://www.example.com', '_blank');
event.completed();
}
On my computer, when the button is clicked, a browser tab is opened with the web page, but for the MS Validation team this message appears in the toolbar at the bottom of the Word window
but nothing else happens.
The message "Patent Bots GCP is working on your Examiner Statistics" is generated by Word and not by my add in. "Patent Bots GCP" is the name of the add in and "Examiner Statistics" is the button label (one of the short strings in the manifest).
Any suggestions for how I can find out what is failing for the Microsoft Validation team? They are not able to provide any details about the error other than what I've included here.
I hope a Microsoft engineer sees this and is able to help.
=====
Maybe it is a popup blocker issue? See this: https://www.tek-tips.com/viewthread.cfm?qid=949178
Following up on Ragavan's comment, I did some searching for unexpected behavior of window.open() on IE11 (IE11 is the browser used in MS Word on Windows 10).
I found this other SO question, that noted
In IE on Windows 10 with default settings, if I perform a
window.open() against an external internet site from a page on my
local machine or a server on my local network, I get null.
that question further noted that
Interestingly, if I turn on "Enable Protected Mode" for the Intranet
Zone (so that Protected Mode are the same in the Intranet Zone and
Internet Zone), then the problem goes away.
I suspect this explains why my add in works on my Windows 10 computer, but not on the validation team's Windows 10 VM.
Unfortunately, the solution proposed in the answer there (w = window.open('') followed by w.location = url) does not work in the Word add in.
While this doesn't fix my problem, hopefully it leads the way to a solution...
#gaefan. Just adding my answer too if any one will have the same problem in future.
If anyone trying to open the external site from their add-in using JS window.open will end up in Object Expected aka validation failure error definitely by Microsoft. It depends on various factors like Windows 10 Build version, Office version and the Browser used by Add-ins.
So to publish your add-in successfully in the App source:
Note: This method is a workaround . But in near future If the new edge chromium version is released. Browser used by Add-ins will be changed. Then the workaround can be eliminated.
Use Task Pane add-in approach if your want to open any external site from Add-in.
The reason for recommonding Task-pane add-in is you can make utilize the anchor tag in your HTML like below
<a
href="https://yourcompany.com/"
class="button-config"
target="_blank"
(click)="performOperation()"
>Sign up
</a>
The reason for click event is to trigger any analytics function or trigger logs or add your custom logic
This will definitely open the external site without changing any settings on your browser.
If you want to stick on with command based add-in try adding new Action or Control button to open a external site via anchor tag.
Hope it will help some one. Thanks

Java webstart replaces jnlp with wifi login page html

My webstart runs fine whenever there is internet connection. It also runs fine when I disconnect from wifi. But it does not work if my computer is connected to public wifi (ie. coffeeshop, airport, etc) such that if I open a browser it forwards me to a html page that asks me to click on a button to connect to internet.
Basically Java webstart thinks that the html welcome page is the new update to my jnlp file so it replaces my jnlp with the welcome page html. Of course that will fail to parse, so I get a parse error and I cannot recover from it unless I completely remove my webstart application from cache and re-download and re-install it.
Has anyone else experienced this? Is there a way to prevent this issue?
I submitted a bug report to OpenJDK:
https://bugs.openjdk.java.net/browse/JDK-8079874
Unfortunately it's marked as incomplete. Evidently I wasn't clear about what the problem is. I'll try to get in touch with them to see which part is not clear.

Can't see dynamically loaded code in Chrome Developer Tools 22

When I dynamically load a snippet of html containing javascript via AJAX, I cannot see that content in the source tab in the developer tools window in Chrome 22.0.1229.94. Tellingly, I went here
https://developers.google.com/chrome-developer-tools/docs/scripts-breakpoints#js_dynamic
This page shows an example developer tools window which is out of date. There is a button on the page to load a dynamic script and it does not show up in the source tab when you do.
As a work-around, I have found that adding
debugger;
to the script and reloading it will cause it to pause in the dynamically loaded code, but unfortunately, all the line numbers are greyed out and you can't set any breakpoints within the debugger.
Am I missing something here or what?
Thanks,
Rob
When you use a library or javascript code that you have loaded it dynamically, you can use the phrase
//# sourceURL=foo.js
at the beginning of your javascript code that foo.js is the name that will be assigned it. debugger will show it with that name.
This is true in chrome, and I think in firebug too.
In this case you can place a breakpoint in the dynamically loaded javascript code.
Possible duplicate of:
Is possible to debug dynamic loading JavaScript by some debugger like WebKit, FireBug or IE8 Developer Tool?
Don't know if this works or not in chrome (This definitely doesn't work for me now, may be in the past).
//# sourceURL=foo.js
Working Solution
For your dynamically loaded script via ajax to appear in your chrome source tool, you need to add the following line at the start or end (I prefer) location of your script file:
//# sourceURL=foo.js
And your script with name foo.js will appear at the left pane of source tab under (no domain) dropdown
->localhost
-- source/src
->(no domain)
-- foo.js
Alternatively you can add the below line in your script anywhere between the scripts.
debugger;
In chrome, you can use " debugger; " statement to break at a statement when debugger panel is open. Chrome will simply ignore this if the debugger panel is closed.
This will help stop your script in debugging mode and you will see your script in source (debugging) panel with name like VM****.
Hope this helps.
You can use //# sourceURL. Chrome doesn't seem to be supporting //# sourceURL for inline scripts. However, it does work on eval expressions. This article gives more details about naming eval blocks and naming of any anonymous functions in your code.
Instead of using eval, you can try embedding a script tag or JSONP may be.
Varunkumar Nagarajan
for me it happened on nodejs project.
i restarted server and open in new tab my app and tada!..
Alternatively, to fix this problem you can open developer tool in a seprate window by clicking the icon. Now reload your script, and it will shown in script tab as expected. I know this is not a solution but a work arround.

Change default browser in Visual Studio 2010 RC

In Visual Studio 2010 (RC) there is no longer a "browse with" context menu when right clicking .aspx pages. How can you change the default browser now?
By default it seems to use the operating system default browser, but I would prefer to use IE when debugging ASP.net apps. (I am testing this with ASP.net MVC 2)
this is the only working way for me:
How do I set my development web browser in VS2010 RC?
There is also a browser switcher extension for Visual Studio, which works perfectly!
http://visualstudiogallery.msdn.microsoft.com/bb424812-f742-41ef-974a-cdac607df921
update:
the extension is removed from the gallery, try this one:
http://visualstudiogallery.msdn.microsoft.com/233945ae-0b7b-47e7-9b02-c5a11798afb5
this browser switching extension is what i use. It's pretty awesome.
EDIT: Possible new link
There is no "Browse With" option on the .aspx Views in an MVC project as they are not meant to be directly browseable.
What I tend to do is add a Default.aspx webform in the root of the site and this, when right clicked, will give you the Browse With option. You need to make sure to update your routing though otherwise IIS/Cassini will try to serve it up, something like this
public void Page_Load(object sender, System.EventArgs e) {
// Change the current path so that the Routing handler can correctly interpret
// the request, then restore the original path so that the OutputCache module
// can correctly process the response (if caching is enabled).
string originalPath = Request.Path;
HttpContext.Current.RewritePath(Request.ApplicationPath, false);
IHttpHandler httpHandler = new MvcHttpHandler();
httpHandler.ProcessRequest(HttpContext.Current);
HttpContext.Current.RewritePath(originalPath, false);
}
Also, another quicky is to hit CTRL-F5 (run without debugging) which will fire up the site without going into debug mode..
I just added a .htm page and right clicked on it. There I had Browse With...
The solution really is not that difficult, though it is not as direct as it ought to be...
In Visual Studio 2010, the Browse With option is available. However, it is not available for MVC Views!
Simply add a Web Form or HTML Page to your project, and Browse With is readily available in it's context menu. Here you can set the Default Browser, and that setting will be used for all subsequent debugging.
No need for complicated code in an Default.aspx page, or changing the Windows defaults.
Looks like this is going to be in a future release.
https://connect.microsoft.com/VisualStudio/feedback/details/533930/default-browser-setting-in-vs2010-not-per-project-helps-debug-user-experience
btw, you can change your default browser:-
In WindowsXP atleast..
Go to Start > Control Panel > Add and Remove progam> Set Program access and defaults > Choose IE from the Web browser dropdown.
Edited:
btw, I did see the "Browse with" item in the right click of an aspx page. When I click on that, I see the list of broswers to choose from. You select one an click "Set as default".
Check this out:
How do I set my development web browser in VS2010?
I'm using VS 2010 RC and I can't see the "Browse with..." option too.
"Browse With.." is available on VS2010.
Left Click the empty space of top panel -> select "Web Browser".
Right click .aspx, "Browse With.." is accessible now.
Go to :
C:\Users\[Your current user]\AppData\Local\Microsoft\VisualStudio\10.0\browsers.xml
clear all contents and save
------if your default browser at the windows is IE new settings change to IE -----
Compile your application
another way (and more easy) that we can do this is:
open the browser that you want, for example, IE and going in
Tools > Options > Programs > and click the button like "Set Default Browser"