WebCabin / wcDocker

wcDocker (Web Cabin Docker) is a powerful window layout system with a responsive and completely interactive design. Move, remove, create, and duplicate panel windows at any time! Organize how you wish! View the demo here:
http://docker.webcabin.org
146 stars 53 forks source link

wcDocker Frame do not load URL when we use jQuery v.3.3.1 #124

Open mzabuawala opened 6 years ago

mzabuawala commented 6 years ago

Hello,

I trying to open a Frame with specific url but it failed with jQuery error, Sample code: frame.openURL('about:blank');

Looking at the source we are passing url as function jQuery.fn.load = function( url, params, callback ) which was working properly in earlier version but with newer version of jQuery it is not working as they have removed the first if condition,

jQuery.fn.load = function( url, params, callback ) {
    if ( typeof url !== "string" && _load ) {                      <----------------- Not present in latest version of jQuery 3.3.1
        return _load.apply( this, arguments );
    }

Code causing issue:

        /**
         * Opens a given URL address into the iFrame.
         * @function module:wcIFrame#openURL
         * @param {String} url - The full, or relative, path to the page.
         */
        openURL: function (url) {
            this.__clearFrame();

            this.$iFrame = $('<iframe>iFrames not supported on your device!</iframe>');
            this.$frame.prepend(this.$iFrame);

            this.__onMoved();
            this._window = this.$iFrame[0].contentWindow || this.$iFrame[0];
            this.__updateFrame();
            this._window.location.replace(url);

            this.$iFrame[0].focus();
            this.$iFrame.hover(this.__onHoverEnter.bind(this), this.__onHoverExit.bind(this));

            var self = this;
            this.$iFrame.load(function () {                                      <----- HERE IS THE PROBLEM
                for (var i = 0; i < self._onLoadFuncs.length; ++i) {
                    self._onLoadFuncs[i]();
                }
                self._onLoadFuncs = [];
            });
        },