etimbo / jquery-print-preview-plugin

jQuery plugin for print preview (modal window)
jquery-print-preview-plugin
382 stars 128 forks source link

iframe permission error in FireFox #10

Open adamflorin opened 11 years ago

adamflorin commented 11 years ago

If the page contains an embedded iframe (e.g. the Vimeo iframe embed code below), Print Preview will fail in FireFox.

<iframe src="http://player.vimeo.com/video/9986699?byline=0&amp;portrait=0&amp;badge=0" width="500" height="375" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>

The error in the FireFox console is Permission denied to access property 'name' when Print Preview tries to access window.frames[i].name (line 47 of jquery.print-preview.js).

I was able to make this more FireFox friendly in an ad hoc way by first checking the frames array. But there's probably a more elegant cross-platform solution. In the meantime:

        // The frame lives
        if (frames["print-frame"]) {
            var print_frame_ref = frames["print-frame"].document;
        } else {
            for (var i=0; i < window.frames.length; i++) {
                if (window.frames[i].name == "print-frame") {    
                    var print_frame_ref = window.frames[i].document;
                    break;
                }
            }
        }

Just FYI. Nice tool, thanks!

josephwaiguru commented 10 years ago

Hi i am processing payments using pesapal(has embedded iframe) but preview can't show.