I have encountered a puzzling issue with two identical ASP.net web application projects: the javascript resource file is not loading in one project, while it loads successfully in the other. I am struggling to understand why this disparity exists and how to resolve it. The javascript code I am using is intended to address the problem of lost focus, as described on this reference link.
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/Scripts/FixFocus.js" NotifyScriptLoaded="true" />
</Scripts>
</asp:ToolkitScriptManager>
Below is the content of the js file:
var lastFocusedControlId = "";
function focusHandler(e) {
document.activeElement = e.originalTarget;
}
function appInit() {
if (typeof(window.addEventListener) !== "undefined") {
window.addEventListener("focus", focusHandler, true);
}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(pageLoadingHandler);
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoadedHandler);
}
// More javascript functions...
Sys.Application.add_init(appInit);