0

Given a region defined by a rectangle and a url, is there any way to determine what elements lie within the given rectangle on the page at the given url?

EDIT: Screen resolution, Font size, etc.. can all be set to reasonable defaults.

Charles Stewart
  • 11,661
  • 4
  • 46
  • 85
Paul Wicks
  • 62,960
  • 55
  • 119
  • 146

2 Answers2

1

Perhaps, but you would nee to use a full browser rendering engine. I'd recommend the QT implementation of webkit. It is fairly simply to get going.

Some things you need to consider:

  • Screen Resolution.
  • Browser Font size.
  • Browser Type.
Byron Whitlock
  • 52,691
  • 28
  • 123
  • 168
1
  • Get the document from the URL.
  • Render it (in a browser).
  • For each element in the browser's DOM:
    • Get the rectangle[s] occupied by the element.
    • Compare the element's rectangle with the rectangle you're interested in.
ChrisW
  • 54,973
  • 13
  • 116
  • 224