I don't think there is a way on the server side to solve this problem. But with Javascript and JQuery you can solve this problem.
script scripts.js js wwwroot. , SayHello undefined, , , undefined, script, JQuery getcript .
.
<button type="button" onClick="sayHello()">Hello</button>
<script>
if (typeof sayHello !== 'function') {
$.getScript( "/js/scripts.js" ).done(function( script, textStatus ) {
console.log( textStatus );
});
}
</script>
,