Signal R is not loaded. Make sure jquery.sigalR-x.js is referenced before ~ ​​/ signalr / js

I link below to two libraries dynamically on my page. When I view my application, the above error did not appear in Chrome browser. But in Internet Explorer, an error occurs.

var signalRLibrary = document.createElement('script');
signalRLibrary.type = "text/javascript";
signalRLibrary.src = 'jquery.signalR-2.1.2.min.js';
document.getElementsByTagName('head')[0].appendChild(signalRLibrary);

var signlaRHub = document.createElement('script');
signlaRHub.type = "text/javascript";
signlaRHub.src = "~/signalr/hubs";
document.getElementsByTagName('head')[0].appendChild(signlaRHub);

While loading the page, I received an error below, because SignalR is not loaded. Make sure jquery.signalR-x.js is referenced before ~ ​​/ signalr / js.

if (typeof ($.signalR) !== "function") {
        throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js.");
}

enter image description here enter image description here

+1
source share
1 answer

JavaScript jQuery ​​SignalR JavaScript. jQuery 1.6.4 , 1.7.2, 1.8.2 1.9.1. , SignalR JavaScript. , HTML, .

<script src="Scripts/jquery-1.10.2.min.js"></script>
<script src="Scripts/jquery.signalR-2.1.0.min.js"></script>
<script src="signalr/hubs"></script>

: jQuery -, SignalR , - SignalR.
- API API SignalR ASP.NET - JavaScript

, - , , .

+3

Source: https://habr.com/ru/post/1690831/


All Articles