What if a html page uses a iframe for images?

Koos Vriezen koos.vriezen at xs4all.nl
Sat Jul 31 01:29:19 BST 2004


On Wed, Jul 28, 2004 at 08:50:11PM +0200, Koos Vriezen wrote:
> Was playing with this on current:
> <html><head><script>
>             var frame;
>             function changeToImage (lnk) {
>                 frame=frames[0];
>                 frame.location = "image.jpg";
>                 func = changeToImage2;
>                 alert ("done1");
>             }
>             function changeToImage2 (lnk) {
>                 frame.location = "simple.html";
>                 func = changeToImage;
>                 alert ("done2");
>             }
>             var func = changeToImage;
>     </script></head>
>     <body>
>         <div onClick="javascript:func (this)">click me</div>
>         <iframe src="simple.html"</iframe>
>     </body>
> </html>

Ok, attached something that makes the above work. Note, the patch is far
from finished, just enough for this example.
This idea is to store a KParts::ReadOnlyPart pointer and a DOM::Node of
the frame in its parent document in KJS::Window instead of only the
KHTMLPart pointer of the frame's document.
If the frame's part is destroyed and DOM::Node handle is not zero (I'm
not quite sure that if node is detached, this handle becomes zero *), a
possible new KPart is search in this handle's document. If one
is found and it's not a KHTMLPart, still some functionality can be uses.
Such as changing the url (emit openURLRequest on its browser extension)

What needs to be done is make sure that *) is correct assumption (and do
I need getDomNode()?) and also allow document.frames[0] to work for frames
that are transformed to other KParts (in the above case it works because
of the 'frame' variable). Also some other properties, like frame dimension,
could work for other KParts.

> > Koos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kjs_window.patch2.gz
Type: application/x-gunzip
Size: 8605 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20040731/4ec04347/attachment.bin>


More information about the kfm-devel mailing list