PDA

View Full Version : DHTML Window widget



Seannal
06-02-2007, 02:52 AM
1) Script Title: DHTML Window widget (v1.03)

2) Script URL (on DD): http://dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem:

I've embedded a flash movie into the popup, but if I press play on the movie and then close the window, the movie continues to play in the background (you can still hear the sound).

Is there any way to shut off the contents inside the window when hitting the close button? Here is a test page:

http://musclegaintruth.com/widget.htm

Any suggestions would be awesome,

Thanks,

Sean

ddadmin
06-02-2007, 06:07 AM
That's because the close() function right now doesn't really stop any of the content within the window from loading, just hide the window. This is out of consideration for the show() function.

A quick but less than ideal solution right now is to add the line:


if (closewinbol){ //if custom event handler function returns true
if (t.state!="minimized") //if this window isn't currently minimized
dhtmlwindow.rememberattrs(t) //remember window's dimensions/position on the page before closing
t.style.display="none"
t.contentarea.innerHTML=""
}

The line in red is new inside dhtmlwindow.js. It should empty the window contents when it is closed.

jscheuer1
06-02-2007, 06:44 AM
With flash though, in IE, just getting rid of the innerHTML might not be enough. I've found that using an iframe to display the flash works out. If you then change the iframe's src attribute, that stops the flash. I don't think the widget script does this automatically though. It (changing the src attribute of an iframe) is the same as changing the top page would be, that also stops flash.

Seannal
06-02-2007, 10:59 PM
With flash though, in IE, just getting rid of the innerHTML might not be enough. I've found that using an iframe to display the flash works out. If you then change the iframe's src attribute, that stops the flash. I don't think the widget script does this automatically though. It (changing the src attribute of an iframe) is the same as changing the top page would be, that also stops flash.

Thanks guys...

What do I need to change the iframe src attribute to?

mburt
06-02-2007, 11:11 PM
A blank page if you want to. For example, just make a blank webpage file (blank.htm) with absolutely nothing in it, and set it as the src.

jscheuer1
06-03-2007, 02:39 AM
An iframe's src attribute may also be changed to about:blank, ex:


document.getElementById('iframe_id').src='about:blank';

This works in all modern browsers. It also saves having to make up a blank page. The only exception I know of would be if you are on a secure page. Then you would need a blank secure page to avoid a security warning.