Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have created one small webpage using html css and js and also I created one small chat-bot from chatbot.com and they told me to paste some code before the closing body tag.

can anyone please explain this code what it is and how it will work.


What I have tried:

<pre>
</script>
<!-- Start of ChatBot (www.chatbot.com) code --><script type="text/javascript">
    window.__be = window.__be || {};
    window.__be.id = "60dd848ce2f997000723cbc7";
    (function() {
        var be = document.createElement('script'); be.type = 'text/javascript'; be.async = true;
        be.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.chatbot.com/widget/plugin.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(be, s);
    })();
</script>
Posted
Updated 1-Jul-21 1:52am
Comments
Richard MacCutchan 1-Jul-21 7:26am    
If you get code from some website and need an explanation of it then go back to that website and ask the people who wrote the code.

1 solution

It's quite simple - it loads a script from the chatbot.com domain into your document. What the script does from there is entirely under the control of that external site.

NB: Since the script doesn't include any subresource integrity[^] attributes, they can change the script at any time, and your site will still load and execute it. If their domain gets hacked, you could be executing malicious script from their site in your own page without knowing it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900