           code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
                    }
                    else {
                        code.textContent = '✖ Error: File does not exist or is empty';
                    }
                }
            };

            xhr.send(null);
        });
    }

    $(document).ready(function(){
        loadExternalCodeSnippets();
    });
    $('#source-view').on('shown', function () {
        loadExternalCodeSnippets();
    })
<