Asp.net-mvc – Where would the on-load handler be in MVC

asp.net-mvconload

I'm looking to add code to my Onload handler but am unsure where it would be in an MVC application?

 // You may want to place these lines inside an onload handler
 CFInstall.check({
     mode: "overlay",
     destination: "http://localhost:1414/"
 });
});

The code above needs to be placed in the onload handler.

Best Answer

If I understand you correctly, you just need this expression below, if you are using jQuery:

<script>
    $(document).ready(function() {
        // Handler for .ready() called. Put your logic here.
    });
</script>

or this one, without usage of jQuery:

<script>
    window.onload = function(){
        // Put your logic here.        
    } 
</script>

to be included on your view.cshtml.