0
votes

This is an EXACT copy of the sample Hello World fiddle. I just pasted it into a fiddle of my own and added the reference to http://knockoutjs.com/downloads/knockout-3.2.0.js. It works in IE 11, but not in Chrome. It does not appear to resolve the knockout reference. Is there a setting or two that is special for Chrome?

// Here's my data model var ViewModel = function(first, last) { this.firstName = ko.observable(first); this.lastName = ko.observable(last);

this.fullName = ko.computed(function() {
    // Knockout tracks dependencies automatically. It knows that fullName depends on firstName and lastName, because these get called

when evaluating fullName. return this.firstName() + " " + this.lastName(); }, this); }; ko.applyBindings(new ViewModel("Planet", "Earth")); // This makes Knockout get to work

https://jsfiddle.net/KellyWCline/rwL4rng9/2/

1
Did you get the answer yet?mmk

1 Answers

0
votes

It's just a security problem: for security reasons, Chrome rejects an script from an HTTP URL when you're inside an HTTPS page. Include Knockout from an HTTPS URL like https://cdnjs.com/libraries/knockout/3.2.0, and it will start working.

If you had looked at Chrome's console you would have seen this error:

Mixed Content: The page at 'https://fiddle.jshell.net/KellyWCline/rwL4rng9/2/show/' was loaded over HTTPS, but requested an insecure script 'http://knockoutjs.com/downloads/knockout-3.2.0.js'. This request has been blocked; the content must be served over HTTPS.