Add custom code to HTML5 client head

124 views
Skip to first unread message

Gerlando Lo Savio

unread,
Jan 15, 2022, 6:10:06 AM1/15/22
to BigBlueButton-Setup
Hello, 
We are using Tawk.to to provide tech support to our students browsing our websites. 

Usually this requires me to add some custom code to html head section, just like this:

<script type="text/javascript">
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/foo/bar/baz';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
</script>

Is there a way to add such code to BigBlueButton HTML5 client code without messing with the main code, that would be replaced on package update? 

It would be useful to add a custom CSS style sheets, too. 

Thanks,
Gerlando Lo Savio

sd...@distancelearning.cloud

unread,
Jan 15, 2022, 8:01:14 AM1/15/22
to bigbluebu...@googlegroups.com

Try inserting it here… and see what happens.

 

/usr/share/meteor/bundle/programs/web.browser/head.html

 

Would need to do everytime you update bbb as it would be overwritten, but that can be done with apply-lib function

 

Regards,

Stephen.

--
You received this message because you are subscribed to the Google Groups "BigBlueButton-Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bigbluebutton-s...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bigbluebutton-setup/90b18e7f-9356-40c1-a62c-1855f8451952n%40googlegroups.com.

Gerlando Lo Savio

unread,
Jan 15, 2022, 8:35:33 PM1/15/22
to BigBlueButton-Setup
Thanks, 
I did as you suggested, and works. 

Since it might be useful to someone else, here's what I did to add Tawk.to code to HTML5 client header.

I added the following code to my /etc/bigbluebutton/bbb-conf/apply-config.sh script (please replace my placeholder code with your actual Tawk.to code):

```
echo "  - Add Tawk.to chat code"
head='/usr/share/meteor/bundle/programs/web.browser/head.html'
if grep -q '<!--Start of Tawk.to Script-->' $head ;
then
        echo 'Tawk.to code already added, nothing to do...'
else
        echo 'Tawk.to code missing, adding it...'
        chmod +w $head
        cat <<- EOF >> $head
        <!--Start of Tawk.to Script-->
        <script type="text/javascript">
        var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();

        (function(){
        var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
        s1.async=true;

        s1.charset='UTF-8';
        s1.setAttribute('crossorigin','*');
        s0.parentNode.insertBefore(s1,s0);
        })();
        </script>
        <!--End of Tawk.to Script-->
        EOF
        chmod -w $head
fi
```

Regards,
Gerlos
Reply all
Reply to author
Forward
0 new messages