Error - permission denied - jQuery preview?

When I click "Print" using jQuery Preview Preview Plugin , the following error message appears: Firebug:

Error: Permission denied to access property 'name'

     if (window.frames[i].name == "print-frame") { 

I'm not sure what that means or how to fix it.

+5
source share
2 answers

There is a way around this to solve this problem and work correctly with all major browsers. This solution was found by Derik on the Github page to preview jQuery .

Here is the solution, around line 44 you will see the following code:

// The frame lives
        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;
            }
        }

Replace the above code as follows:

print_frame_ref = print_frame[0].contentWindow.document;

the problem is resolved.

+3
source