Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    javascript errors related to document.domain when trying isc.Canvas.showPrintPreview

    Hi, I'm trying to use isc.Canvas.showPrintPreview and I'm getting errors in multiple browsers. Our application uses document.domain and it looks like that is the source of the problem. When I temporarily turn off document.domain, the print preview window shows without issue.

    Here are the javascript errors we see:

    Unsafe JavaScript attempt to access frame with URL http://localdev.<mydomain>.com:8080/dev/dpt.form from frame with URL http://localdev.<mydomain>.com:8080/dev/isoversion/8.1.8.27.11/isomorphic/system/helpers/printFrame.html?id=isc_PrintCanvas_0&title=Print%20Preview. Domains, protocols and ports must match.


    printFrame.html:30Uncaught ReferenceError: params is not defined

    #2
    FYI, I tried a variant of the document.domain synchronization code you've provided in the past like this:

    Code:
    
    if (!window.isc && window.parent != null) {
        while (document.domain.indexOf(".") != -1) {
            try {
                
                if (window.parent.isc === undefined) {
                    try {
                        document.domain = document.domain.replace(/.*?\./, '');
                    } catch (ee) {
                        break;
                    }
                } else {
                    break;
                }
            } catch (e) {
                try {
                    document.domain = document.domain.replace(/.*?\./, '');
                } catch (ee) {
                    break;
                }
            }
        } 
    }
    That seems to work in Chrome but still throws a javascript error. It doesn't work in Firefox though. Hard-coding the domain in the file seems to work for the time being.

    Comment


      #3
      Just to confirm, the error message says that domain, protocol and port must match, and they do match. Is this happening only when you set your main page to a value for document.domain, and the print frame is not set to the same?

      Comment


        #4
        The main page of our app sets document.domain. The print frame does not set document.domain and thus the error happens. When I hard-code the document.domain into the printFrame.html file, it works fine. When I try to use the document.domain synch code, it seems to partially work in Chrome but not work at all in Firefox.

        Comment


          #5
          Hi there. Just following up on this thread. I just pulled down the latest 8.2 nightly and noticed there is still no document.domain synchronization logic in printFrame.html. This means we have to manually add our document.domain to this file every time we grab a new version of SmartClient. Is this something you'll be able to fix so this manual step is not needed on our part?

          Comment


            #6
            Yes, we will eventually do so.

            Comment

            Working...
            X