feat: Adds async and defer attributes to chatwoot script tag (#2890)

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
This commit is contained in:
Fayaz Ahmed 2021-08-26 19:51:10 +05:30 committed by GitHub
parent 5853531d9a
commit 0a08e1ffc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 0 deletions

View file

@ -630,6 +630,7 @@ GEM
PLATFORMS PLATFORMS
arm64-darwin-20 arm64-darwin-20
x86_64-darwin-20
x86_64-darwin-21 x86_64-darwin-21
x86_64-linux x86_64-linux

View file

@ -59,6 +59,8 @@ class Channel::WebWidget < ApplicationRecord
var BASE_URL=\"#{ENV.fetch('FRONTEND_URL', '')}\"; var BASE_URL=\"#{ENV.fetch('FRONTEND_URL', '')}\";
var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=BASE_URL+\"/packs/js/sdk.js\"; g.src=BASE_URL+\"/packs/js/sdk.js\";
g.defer = true;
g.async = true;
s.parentNode.insertBefore(g,s); s.parentNode.insertBefore(g,s);
g.onload=function(){ g.onload=function(){
window.chatwootSDK.run({ window.chatwootSDK.run({

View file

@ -66,6 +66,8 @@
var BASE_URL=""; var BASE_URL="";
var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=BASE_URL+"/packs/js/sdk.js"; g.src=BASE_URL+"/packs/js/sdk.js";
g.defer = true;
g.async = true;
s.parentNode.insertBefore(g,s); s.parentNode.insertBefore(g,s);
s.async=!0; s.async=!0;
g.onload=function(){ g.onload=function(){

View file

@ -24,6 +24,8 @@ window.chatwootSettings = {
var BASE_URL = ''; var BASE_URL = '';
var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src= BASE_URL + "/packs/js/sdk.js"; g.src= BASE_URL + "/packs/js/sdk.js";
g.defer = true;
g.async = true;
s.parentNode.insertBefore(g,s); s.parentNode.insertBefore(g,s);
g.onload=function(){ g.onload=function(){
window.chatwootSDK.run({ window.chatwootSDK.run({