[whatwg] cross-domain scrollIntoView on frames and iframes

Ojan Vafai ojan at chromium.org
Fri Apr 3 13:20:20 PDT 2009

I'm suggesting an addition to cross-domain (i)frames that allows scrolling
specific content into view. The use case is sites that aggregate data from
many sites (e.g. search engines) and want to display that data in an iframe.
They can load the page in an iframe, but they have no way to make the
content visible as they don't have access to the iframe's contents.

A few possible APIs come to mind. I personally prefer the javascripty option
below, but I'll include another one for good measure.

1) Add a scrollPathIntoView (with a better name) on iframes that takes
either an xpath or a css selector and scrolls the specified item into view.
If no such item exists, it does nothing. If one or more such items exist, it
calls scrollIntoView on the first matching item.
2) Add a css or xpath expression to fragment identifiers. Tthe iframe src
can be set to http://foo.com#css(.foo <http://foo.com/#css(.foo> #bar). Same
as above applies. If there's no match, it's a noop. If there is a match, it
scrolls the first one into view.

In both cases, no explicit success or failure is returned to the caller as
that would leak the iframes DOM across domains.

This API can obviously be supported on same-domain iframes as well, but it's
not really necessary since you can just dig into the DOM of the iframe.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090403/9a8f27c7/attachment-0002.htm>

More information about the whatwg mailing list