This bind method is only supported by the ie10 browser. If it is earlier than this version, an undefined error message is displayed. So I had to go online with the Google solution again, but I had to pay close attention to it. We found a solution on the Firefox development site, that is, adding the property prototype so that all browsers can support the bind method. The Code is as follows:
<script type="text/javascript">if (!Function.prototype.bind) { Function.prototype.bind = function (oThis) { if (typeof this !== "function") { throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function () {}, fBound = function () { return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } </script>
It mainly solves the bug of the example on the official Baidu MAP website and extracts the following code:
<! Doctype HTML>
IE8 supports the function. BIND () method.