I have been trying to add HTML code containing Javascript from an Affiliate platform to my blog site.
I copy pasted the code from Klook/Headout site(affiliate platform) and pasted in the HTML code blocks. But after pasting the code, the wordpress editor shows the preview of the code within the block editor but not on the actual preview page. When I hit publish it throws errors such as – The response is not a valid JSON reponse, Server error(403 error), the firewall like cloudfare etc., in your site is’t allowing to publish. I tried again by removing the script tag, by this way it allows me to publish the code. Kindly help to solve this issue. Fyi: I am not a pro in coding. Attaching the screenshot of the issue showing in the browser console. View the screenshot here
<script type="text/javascript">
(function (d, sc, u) {
var s = d.createElement(sc),
p = d.getElementsByTagName(sc)[0];
s.type = "text/javascript";
s.async = true;
s.src = u;
p.parentNode.insertBefore(s, p);
})(
document,
"script",
"https://affiliate.klook.com/widget/fetch-iframe-init.js"
);
</script> ````
[1]: https://i.stack.imgur.com/zm3Pi.jpg