Recently was writing a jscript function to populate optionset value using SDK.MetaData.js helper class.
It was working fine in IE, however I was getting error in Chrome.
It turned out the following condition was always evaluating as true
And as selectSingleNode is not supported in Chrome we were getting error.
Added the following condition fixed the issue
if (typeof(window.chrome) != ‘undefined’) {
var xpe = new XPathEvaluator();
var xPathNode = xpe.evaluate(xpathExpr, node, _NSResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
return (xPathNode != null) ? xPathNode.singleNodeValue : null;
}
Hope it helps..
Hi,
thank you for your post. I’m looking for a solution to a similar problem. But I’m not sure if I understand your approach 100%.
typeof(window.chrome) != “undefined” is true when the browser is Chrome, right? If that’s the case you use the out-of-the-box else-block.
If I do that I get “Uncaught NotSupportedError: Failed to execute ‘evaluate’ on ‘XPathEvaluator’: The node provided us null.” although the node is of course not null
I’m a little lost on this one since I feel like neither of the two options in the function works in Chrome. Would you mind giving me a pointer to how exactly the structure is after your change?
LikeLike