When I run the following code to capture ld+json content, it returns the ld+json content as well as JS code at the end of the JSResult variable. This prevents the Convert JSON to customer object action from running. Any ideas why that code is being returned and how to prevent it?
Thanks, John
Run JavaScript function on web page JavaScript Function:
function ExecuteScript() {
var headings = document.evaluate("//script[contains(., 'gtin')]", document, null, XPathResult.ANY_TYPE, null );
var thisHeading = headings.iterateNext();
var result = "";
while (thisHeading) {
result += thisHeading.innerText;
thisHeading = headings.iterateNext();
}
return result;
}
Weird code at end of JSResult variable.
var result = undefined; try{ result = (function ExecuteScript() {
var headings = document.evaluate("//script[contains(., 'gtin')]", document, null, XPathResult.ANY_TYPE, null );
var thisHeading = headings.iterateNext();
var result = "";
while (thisHeading) {
result += thisHeading.innerText;
thisHeading = headings.iterateNext();
}
return result;
})();;}catch(e){}; document.documentElement.setAttribute("result", result); document.documentElement.setAttribute("complete", "true");

Report
All responses (
Answers (