Results 1 to 4 of 4

Thread: No such interface supported

  1. #1
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default No such interface supported

    Hey there

    I've been using Dynamicdrive's dhtml Modal window code with, initially, great success. However, i've now hit a rather large snag. If the pop-up modal window displays a 'regular' HTML form, everthing appears to work okay. But, I also have a requirement to open a previously generated pdf file in a pop-up window and this is where i come unstuck. The pdf document opens and displays fine, the problem comes when i click on the 'X' closewindow button at the top-right of the modal window. When i click this i get a javascript error 'No such interface supported' with the IE8 debugger pointing at line 55 of modal.js...

    t.contentDoc=(t.contentarea.datatype=="iframe")? window.frames["_iframe-"+t.id].document : t.contentarea //return reference to modal window DIV (or document object in the case of iframe

    As previously stated, i'm using IE8 and it's on a Win XP SP3 machine

    If anyonce can shed any light on this issue and, hopefully, provide a solution, that would be great.

    Thanks, PG
    Last edited by perl_geek; 10-31-2011 at 02:40 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    IE 8 is correct. Other browsers would probably agree. The script wasn't expecting anything other than an HTML page there. A PDF file has no javascript document object. But you shouldn't need a reference to it to close the dhtml Modal window. I suspect you're using the same dhtml Modal window that you used for the form. That window is probably looking for the form to know whether or not it's allowed to close and/or what it should do as it closes. Perhaps you have something like this:

    Code:
    var agreewin=dhtmlmodal.open("agreebox", "iframe", "modalfiles/agreement.htm", "This Page's Terms of service", "width=590px,height=450px,center=1,resize=1,scrolling=0", "recal")
    
    agreewin.onclose=function(){ //Define custom code to run when window is closed
    	var theform=this.contentDoc.getElementById("eula") //Access form with id="eula" inside iframe
    	var yesbox=theform.eulabox[0] //Access the first radio button within form
    	var nobox=theform.eulabox[1] //Access the second radio button within form
    	if (yesbox.checked==true)
    		alert("You agreed to the terms")
    	else if (nobox.checked==true)
    		alert("You didn't agree to the terms")
    	return true //Allow closing of window in both cases
    }
    Either use a different dhtml Modal window, one without that check. Or you could try this approach (additions changes/highlighted):

    Code:
    var agreewin=dhtmlmodal.open("agreebox", "iframe", "modalfiles/agreement.htm", "This Page's Terms of service", "width=590px,height=450px,center=1,resize=1,scrolling=0", "recal")
    
    agreewin.onclose=function(){ //Define custom code to run when window is closed
    	var theform;
    	try { //does this iframe contain a javascript document object?
    		theform = this.contentDoc.getElementById("eula") //Access form with id="eula" inside iframe
    	} catch(e){ //if not:
    		return true; //allow closing of window
    	}
    	var yesbox=theform.eulabox[0] //Access the first radio button within form
    	var nobox=theform.eulabox[1] //Access the second radio button within form
    	if (yesbox.checked==true)
    		alert("You agreed to the terms")
    	else if (nobox.checked==true)
    		alert("You didn't agree to the terms")
    	return true //Allow closing of window in both cases
    }
    The browser cache may need to be cleared and/or the page refreshed to see changes.

    There could be other problems. If you want more help:

    Please post a link to a page on your site that contains the problematic code so we can check it out.
    Last edited by jscheuer1; 10-31-2011 at 04:17 PM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Resolved (i think)

    John

    Thanks for the response. I'm not sure if what i've done is correct/wise but it doesn't seem to have done any harm, from what i can see at least. As the line

    t.contentDoc=(t.contentarea.datatype=="iframe")? window.frames["_iframe-"+t.id].document : t.contentarea //return reference to modal window DIV (or document object in the case of iframe

    was generating the 'No such interface supported' error, i tried commenting out this line. I no longer get the error and have not seen any adverse effects.

    Perhaps you could advise if this is not a wise thing to do?

    Thanks, PG

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It's OK. But if you need it for a modal - say, one containing a form, it won't be there.

    If it was only a problem when you went to close your modal PDF, my solution should work and leave the option for other modals or even other content in the same modal that needs that. But if the error came without having to try to close the modal, we can still probably have it both ways by doing a try/catch on that line.

    Then again, if it works and you have no modal iframe that requires a reference to an html document within the modal iframe, I'm pretty sure what you've done is serviceable.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •