Hi folks,
I am making a request that returns HTML in which a form is built using JavaScript and submitted on page load, for example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Identifying...</title>
</head>
<body>
<script>
var tdsMethodNotificationValue = 'eyJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjRiMjZiZjMyLTk4YmEtNGM4Yi1hN2ZlLWFhNDRlMjg5YmViMiJ9';
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", "https://example.com");
addParameter(form, "threeDSMethodData", tdsMethodNotificationValue);
document.body.appendChild(form);
form.submit();
function addParameter(form, key, value) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", value);
form.appendChild(hiddenField);
}
</script>
</body>
</html>
I’ve set up a visualizer in a test like so:
const html = pm.response.text();
// set that template to pm.visualizer
pm.visualizer.set(html);
However, when I click the Visualize tab, the form is not posted. I can see it is rendered by opening the inspector but I wondered if there are any restrictions on what can be rendered/executed? For example, I tried a simple alert
within a template and this also failed to run.