javascriptpageloadmicrosoft-ajax

Getting pageLoad error in MicrosoftAjax.js


I am writing an asp.net web forms website that requires users to login. I am experiencing some errors with the raiseLoad function in MicrosoftAjax.js after they have logged on.

MicrosoftAjax.js is loaded as a bundle

<asp:PlaceHolder runat="server">
    <%: Scripts.Render("~/bundles/modernizr") %>
    <%: Scripts.Render("~/bundles/WebFormsJs") %>
    <%: Scripts.Render("~/bundles/MsAjaxJs") %>
</asp:PlaceHolder>

My BundleConfig file is

Public Class BundleConfig
    Public Shared Sub RegisterBundles(ByVal bundles As BundleCollection)
        bundles.Add(New ScriptBundle("~/bundles/modernizr").Include(
            "~/Scripts/modernizr-*"))

        bundles.Add(New ScriptBundle("~/bundles/WebFormsJs").Include(
            "~/Scripts/WebForms/WebForms.js",
            "~/Scripts/WebForms/WebUIValidation.js",
            "~/Scripts/WebForms/MenuStandards.js",
            "~/Scripts/WebForms/Focus.js",
            "~/Scripts/WebForms/GridView.js",
            "~/Scripts/WebForms/DetailsView.js",
            "~/Scripts/WebForms/TreeView.js",
            "~/Scripts/WebForms/WebParts.js"))

        bundles.Add(New ScriptBundle("~/bundles/MsAjaxJs").Include(
            "~/Scripts/WebForms/MsAjax/MicrosoftAjax.js",
            "~/Scripts/WebForms/MsAjax/MicrosoftAjaxApplicationServices.js",
            "~/Scripts/WebForms/MsAjax/MicrosoftAjaxTimer.js",
            "~/Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js"))

    End Sub
End Class

When I run my website on different browsers, I get different errors

IE11 is the only browser that displays a popup asking if the user would like to debug the error (even though I have Disable script debugging ticked)

I have done numerous searches on google and bing for "Object doesn't support property or method 'pageLoad'" and I can find hundreds of "Object doesn't support property or method 'xxx'" pages where 'xxx' might be 'insert', 'includes', 'assign', 'startswith' etc but never 'pageLoad'.

I have also done numerous searches for "TypeError: window.pageLoad is not a function" and all the results refer to window.onload.

The resultant pages all seem to refer to an error in the developer's website code, not a third party javascript file.

I have even searched for "MicrosoftAjax.js pageLoad error" and "MicrosoftAjax.js error" but none of the results relate to pageLoad.

I suspect that this error is a very simple one in my web page that manifests as the errors I am getting but I have no idea where to even start looking.

I only have until January to resolve this issue so any help in resolving this issue would be appreciated


Solution

  • I have found the answer to my issue on the website below: -

    JavaScript pageLoad() for MasterPage and ContentPage

    Basically, I needed to add a pageLoad event to my master page: -

    function pageLoad(sender, args){
        if (window.contentPageLoad) {
            window.contentPageLoad(sender, args);
        }
    }
    

    And replaced the following '$(document).ready' function with 'contentPageLoad' function on my content page: -

    $(document).ready(function () {
        $('.hyperlinkTest').tooltip({
            tooltipClass: "tooltip"
        });
    
        $('.hyperlinkMaint').tooltip({
            tooltipClass: "tooltip"
        });
    });
    

    with : -

    function contentPageLoad(sender, args) {
        $(".hyperlinkTest").tooltip({
            tooltipClass: "tooltip",
        });
    
        $(".hyperlinkMaint").tooltip({
            tooltipClass: "tooltip",
        });
    }
    

    My error has not reared its ugly head since I added both pieces of code.