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

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

Related

ModalPopupExtender doesn't show on some computers

I maintain a vb.net website. A button on a page shows an AjaxControlToolkit.dll ModalPopupExtender. When I click the button, the page reloads, but no popup appears.
My tests below cover the scenarios I can think of. Please help me diagnose and fix.
This ModalPopupExtender succeeded in the past. The error might have started when we moved to a new server, or when we implemented https, or a browser update, or at some other time since then.
Tried Chrome (latest) and Firefox.
I RDPed into the server and opened the page in Chrome there. ModalPopupExtender succeeded. Same Chrome version as my PC. So, unlikely to be a code issue.
A different page on the same site uses ModalPopupExtender successfully. So, unlikely to be local PC settings.
I put lines of test code immediately before and after ModalPopupExtender.Show(). Both succeed.
Aha - found it!
Solution
The ASPX/HTML referred to http://ajax.googleapis.com. Changing the references to https made ModalPopupExtender.Show() work correctly for me.
Explanation/Diagnosis (if you can clarify further, please comment)
When I checked the html served to my browser, I noticed it defined a javascript function called fn(). The definition for fn() didn't appear in the html served to the server's browser. After the https change, fn() no longer appears in the html I receive. The other page, where ModalPopupExtender worked, didn't have any reference to googleapis.com.
I assume that using http instead of https caused ajax.googleapis.com to provide fn() and that fn() in some way interfered with the normal operation of my ModalPopupExtender.
Here's the fn() definition: (function {var fn = function() {Sys.Extended.UI.ModalPopupBehavior.invokeViaServer('ctl00_cphContent_ModalPopupExtenderConfirm', true); Sys.Application.remove_load(fn);};Sys.Application.add_load(fn);})();
Note: the http also included another javascript function related to the ModalPopupExtender. But there was a similar one on the working page, and in the working version served to the server's browser, and in my fixed version. So, I assume that function is correct.

Dynamics 365/CRM Chrome Debugger not working correctly

I've spent more time on this than I care to admit but was hoping for some help in understanding the cause of the problem. I have a basic HTML web resource in Dynamics 365 (v9.1.0.9228) and in order to get the global context I must include the following:
<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>
https://learn.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/getglobalcontext-clientglobalcontext.js.aspx
The problem is that when I do... the Chrome debugger loses its place in the document. The execution stops at the breakpoint(s) but the current line is not highlighted this means no way to step into/over the lines or indeed know what line we are on at any given point. I can see however that the code is being executed due to my output to console (See code in footer).
I have tested this across:
Multiple D365 online instances (v9.1.0.9228)
Multiple development machines running Chrome (v77.0.3865.90)
Literally stripped back the code to very basic HTML. Interestingly, this issue does not occur in IE? The only workaround I have found is rather than having inline JS within the head tags place it a separate file instead and reference from the HTML web resource, Chrome then seems to have no issues in stopping on right line and highlighting the correct line as we debug BUT only functions within that library. If the HTML web resource has inline script the issue will still be present within that scope.
head
<script type="text/javascript" src="ClientGlobalContext.js.aspx"></script>
<script type="text/javascript">
function registerEvents() {
debugger;
console.log("in registerEvents v2.0.3");
testButton = document.getElementById("test");
testButton.onclick = test;
}
function test() {
debugger;
console.log("in Test v2.0.3");
}
</script>
body
<script type="text/javascript">
registerEvents();
</script>
<p>In chrome debugger v2.0.3</p>
<button id="test">Test</button>
I would like to understand if I am doing something wrong here as it seems to be a bug within Chrome DevTools itself given this works on all other browsers when debugging? The actual code here is almost irrelevant as the issue occurs whenever "ClientGlobalContext.js.aspx" is referenced, if we comment out that line the Chrome debugger works as expected.

Moodle Scorm Course Resume

I am using Moodle 3.2.2 and I upload Scorm course Dispatch file in Moodle. Everything is working fine except Resuming course.
I created my own dispatch file like Scorm cloud does. When I test the same course by download Scorm cloud dispatch file its working fine. But My dispatch file in Moodle is not resuming the course.
Note:
I use iSpring Presenter to create SCORM course.
This is the dispatch structure of files I have.
The dispatch.html code is
<html>
<head>
<title></title>
<meta charset="utf-8" />
<script src="configuration.js"></script>
<script src="utils.js"></script>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script type="text/javascript">
include_script(DispatchRoot + "/scripts/client-driver.js");
include_script(DispatchRoot + "/scripts/client-loader.js");
</script>
</head>
<frameset id="dispatch_frameset" rows="0,*" frameborder="0" framespacing="0" border="0" onload="DispatchStart('dispatch_course_frame')"
onunload="DispatchUnload()">
<!-- We set the src to blank.html to avoid security warnings in IE6 / IE7 when launching in HTTPS -->
<!--<frame id="dispatch_content_frame" name="dispatch_content_frame" src="blank.html" />-->
<frame id="dispatch_loading_frame" name="dispatch_loading_frame" src="blank.html" />
<frame id="dispatch_course_frame" name="dispatch_course_frame">
</frameset>
<noframes>
Your browser must be able to view frames for this content to display.
</noframes>
</html>
client-driver.js is a file which helps to build communication between LMS and SCORM. while client-loader.js file is where communication happens. I am using following code
var completionStatus = Getvalue("cmi.core.lesson_status");
if (completionStatus == "not attempted") {
SetValue("cmi.core.lesson_status", "incomplete");
}
SetValue("cmi.core.exit", "suspend");
console.log(Getvalue("cmi.core.student_id"));
console.log(Getvalue("cmi.core.student_name"));
var entry = Getvalue("cmi.core.entry")
console.log(entry);
if (entry == "resume") {
var val = Getvalue("cmi.suspend_data");
SetValue("cmi.suspend_data", val);
}
else {
SetValue("cmi.suspend_data", "2");
}
When the user close the Moodle LMS window this code execute
SetValue("cmi.core.exit", "suspend");
api.LMSCommit("");
api.LMSFinish("");
But next time I am unable to resume course. Can anyone tell me where I am doing wrong? How to resume course from the last slide.?
I'm going to dig this up from some real old knowledge so bare in mind you need to verify it. I believe the way Moodle was coded; if you set any status it may trigger the SCO to re-launch in "Review" mode which will bugger up your cmi.core.entry. I had to explicitly setup a 'do not status until finish' option in my Content API Library to deal with this issue. Do not confuse "Finish" with "LMSFinish". Its more or less "the student is done with the attempt". Most SCORM 2004 users set the status of the SCO to incomplete when its 'not attempted'. It makes sense. With one glaring difference - In SCORM 1.2 there is only one status for passed, failed, completed or incomplete (not attempted).
Check your cmi.core.lesson_mode to see if my theory is correct on a second launch.
As content developers we probably could have been doing a better job to expose UI elements to hit "I am done" like a turning in of your homework. Some LMS systems even went to extents to put 'done' buttons in their TOC's or Lesson Viewers.
These terms often confuse people and some of it was addressed in SCORM 2004. I believe Moodle abandoned their SCORM 2004 Runtime support.
Keep in mind Moodle also allows data to be set against a SCO in review mode. SCORM didn't exactly dictate what a LMS should do in this situation, but Moodle opted to allow that to continue to change the student attempt. My opinion here is this is a "never ending attempt". We could debate whether this is right/wrong or indifferent - but ultimately the SCORM white paper for 1.2 was mainly optional vs mandatory, and they didn't call out what a LMS should or shouldn't do on this. We'd need a time machine to go back to 2001.

GWTBootstrap3 components rendering incorrectly in IE11

My page elements should appear in all browsers as follows:
I can only achieve this in IE11 by having the dev tools open during page load, otherwise the page generates as the following:
Summary
no rounded corners on box elements
no column alignment (bootstrap class "col-lg-2" on
all label elements)
Legend formatting not added
general alignment off
no smooth accordion transition - open or closed
This issue is only with IE11, the site works in chrome, firefox and even Safari without any additional plumbing. I have found some IE fixes on SO, but so far none of them have worked:
*.html - add meta information to use Edge engine
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<html>
<head>
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<![endif]-->
... html continues with rest of head
*.js - to prevent undefined console from blocking processing
if(!window.console) {
console.log(item);
}
I have been sure to use Ctrl F5 when reloading the page for testing, and have also restarted devmode to see if that makes a difference. I have also confirmed that the site is not running in compatibility mode by looking in the compatability settings.
Looking through the logs I can see that when the page loads with dev tools closed, the binding is carried out using user.agent=ie8, whilst with devtools open, the binding property is user.agent=gecko1_8. I thought IE11 should always use the gecko1_8 permutation - why could this not be happening?
(using GWT Version 2.7)
Not sure if this will be of any help.
We are using GWT (2.8, but I think it also worked with 2.7 in the past).
With GWT-Bootstrap3 (https://github.com/gwtbootstrap3/gwtbootstrap3) without any problems in IE11. I am not sure you are using the same bootstrap library ?
Anyway. We added the following line in our html file (as the first line of the head tag) :
<meta http-equiv="x-ua-compatible" content="IE=10">
I can not really remember how I came up with this line, but the version history states : "It is now possible to use IE11 in compatibility mode"
So it has to do something with fixing something in IE-11, using GWT and bootstrap 3 :-)

GWT 2.7: Warn users they are using an unsupported browser

I recently upgraded my application to GWT 2.7 from GWT 2.5. This has caused me to drop support for IE6 and IE7.
I would like to provide users with IE6 or IE7 with a warning that their browser is outdated and will not work. At the moment if you go to the app with one of those browsers, you get a blank screen.
I know there are a couple ways that I could hack something together but I would rather use the GWT way, rather than some hack. Is there a GWT hook for unsupported browsers?
Option (hack) One
Drop this into my main.html:
if(document.documentMode === 6 || document.documentMode === 7){
myUnsupportedBrowserWarningFunction();
}
Potential problem with this is that if someone is using a browser that GWT doesn't recognise and I don't recognise (mobile opera? Some other browser), they will still get a blank page.
Option (hack) Two
GWT looks for the compiled JS here:
gwt/myApp/ASDFKLSDJFLSFDJSLDFJLSJDFSDES.cache.js
When someone is using an unsupported browser the following is requested (and is not found):
gwt/myApp/undefined.cache.js
It would be possible to create undefined.cache.js and put your unsupported browser code there. This is obviously a brittle solution and will break with future GWT updates.
Option Three
A recent patch (available in GWT 2.7) allows you to provide a default
permutation (e.g. safari) if GWT can not detect the browser and with
deferred binding you can display a warning that the provided app might not
work correctly as the browser is generally unsupported by GWT.
-- J.
Source
I don't want to set a default permutation for unsupported browsers. I want the site to not work and to display a warning. So this solution doesn't really provide what I am looking for.
Similar Questions & Posts
The same question was asked for an eariler version of GWT in 2009. I hope that GWT has added some kind of hook or best practice in the last 6 years.
More info on setting a default (fallback) permutation
You should be able to use onLoadErrorFn for that: https://code.google.com/p/google-web-toolkit/issues/detail?id=8135
<script>
function gwtLoadError(errMsg) {
// GWT app couldn't load, reason in errorMsg
}
</script>
<meta name="gwt:onLoadErrorFn" content="gwtLoadError">
or possibly onPropertyErrorFn:
<script>
function gwtPropError(propName, allowedValues, actualValue) {
if (propName == 'user.agent') {
// unsupported browser
}
}
</script>
<meta name="gwt:onPropertyErrorFn" content="gwtPropError">
(I don't think user.agent.runtimeWarning would help in this case, but maybe have a look)
There is an easy way:
Conditional Comments
<!--[if lt IE 8]>
<p>You are using an unsupportet browser. Please perform an update</p>
<![endif]-->
I think Option 3 may be the best one, but there is a problem: This will start the actual application (which still may be incompatible).
If this is an issue and you want a clear warning, you can rewrite the permutation selection script (You would need to update the script with the upcoming GWT releases)
You will need to copy this source:
https://gwt.googlesource.com/gwt/+/2.7.0/user/src/com/google/gwt/useragent/rebind/UserAgentPropertyGenerator.java
You could add something like:
$wnd.Location.replace('nosupported.html');
between line 90 and 91