Bug 107142 - Browser widget get HTML/source
Summary: Browser widget get HTML/source
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0.2   Edit
Hardware: PC All
: P3 enhancement with 8 votes (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy
: 44636 55352 111611 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-08-16 14:00 EDT by Todd Behr CLA
Modified: 2008-12-14 02:22 EST (History)
17 users (show)

See Also:


Attachments
My solution to add a getText() accessor to the Browser class (39.82 KB, patch)
2005-08-16 14:05 EDT, Todd Behr CLA
no flags Details | Diff
Same As Previous Solution, one int field (info) and two constants have been added (41.22 KB, text/plain)
2005-09-15 08:32 EDT, kent gibson CLA
no flags Details
final win32 Browser getText implementation (1.94 KB, patch)
2005-10-06 15:38 EDT, Grant Gayed CLA
no flags Details | Diff
final Safari Browser getText implementation (3.16 KB, patch)
2005-10-07 14:06 EDT, Grant Gayed CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Todd Behr CLA 2005-08-16 14:00:46 EDT
The org.eclipse.swt.browser.Browser class offers no public accessor for
getText() in order to return the HTML/source of the web page once rendered.  I
have successfully modified the Browser.java source to allow for such an ability,
but I was not sure if this feature was not included for an explicit reason.  I
will be happy to share my modification if such a solution/enhancement is
merited.  Thank You.
Comment 1 Todd Behr CLA 2005-08-16 14:05:19 EDT
Created attachment 26168 [details]
My solution to add a getText() accessor to the Browser class

Allows for the retrieval of rendered HTML from the Browser class
Comment 2 kent gibson CLA 2005-09-15 08:32:38 EDT
Created attachment 27161 [details]
Same As Previous Solution, one int field (info) and two constants have been added

 New Field:  int info;
 
 New Constants:
 static final int DOCHOSTUIFLAG_NO3DOUTERBORDER = 0x00200000;
 static final int DOCHOSTUIFLAG_THEME = 0x00040000;

 to constructor:

 info = Browser.DOCHOSTUIFLAG_THEME;
 if ((style & SWT.BORDER) == 0) info |= Browser.DOCHOSTUIFLAG_NO3DOUTERBORDER;
Comment 3 Grant Gayed CLA 2005-10-05 10:35:08 EDT
*** Bug 111611 has been marked as a duplicate of this bug. ***
Comment 4 Grant Gayed CLA 2005-10-06 15:38:48 EDT
Created attachment 27963 [details]
final win32 Browser getText implementation

To update, I've attached a final win32 Browser.getText() patch for 3.2, based
largely on the one that was originally attached in comment 1.  Thanks for
looking into this and for submitting the patch!

I've investigated this in mozilla, and it's a much more complicated task there
(at least without writing to the local file system, which is undesirable).  I
have a POC that makes it work, but it uses way too many unfrozen APIs to commit
to at this time.

Will revisit this issue later in the 3.2 cycle.
Comment 5 Grant Gayed CLA 2005-10-07 14:06:15 EDT
Created attachment 28042 [details]
final Safari Browser getText implementation

Just for fun, here's the Safari implementation too.
Comment 6 Grant Gayed CLA 2005-10-07 14:35:02 EDT
*** Bug 55352 has been marked as a duplicate of this bug. ***
Comment 7 Giovanni Aiello CLA 2005-10-08 08:30:25 EDT
Is is possible to have the wm2003 version of getText() method?
Comment 8 Grant Gayed CLA 2005-10-11 08:47:10 EDT
Assuming you mean windows server 2003, it should be the same as comment 4.
Comment 9 Linda Smith CLA 2006-02-08 16:31:14 EST
What is very useful is to have two methods getText() and getHTML() to return the text as displayed and the raw html, respectively.
Comment 10 Grant Gayed CLA 2007-02-09 12:07:26 EST
*** Bug 44636 has been marked as a duplicate of this bug. ***
Comment 11 Bruce Ho CLA 2007-08-02 17:40:25 EDT
any chance someone create a patch for v3.3? The current patch does not work for that.
Comment 12 Bruce Ho CLA 2007-08-04 17:22:40 EDT
I found out that the patch does still work, but you have to move it to the IE class, instead of the Browser class.
Comment 13 Grant Gayed CLA 2007-08-23 16:30:48 EDT
fixed > 0823, added Browser.getText() API which returns a string with HTML

Adding "contributed" keyword since the win32 implementation took some inspiration from the attachment in comment 1.
Comment 14 Chris Aniszczyk CLA 2007-08-23 16:31:55 EDT
Thanks!
Comment 15 Alex Blewitt CLA 2007-08-24 03:47:08 EDT
What's the state of this on other platforms e.g. Linux, Mac? Or has it just been resolved for the win32 case?
Comment 16 Grant Gayed CLA 2007-08-24 09:24:45 EDT
It's implemented for Mozilla and Safari as well.
Comment 17 Alex Blewitt CLA 2007-08-24 16:50:15 EDT
Cool. In that case, can you change this to 'All' instead of 'windows' and then I think this is particularly noteworthy too; a keyword 'noteworthy' might be in order :-)

http://mea-bloga.blogspot.com/2007/08/noteworthy-keyword.html

Alex
Comment 18 Grant Gayed CLA 2007-08-24 17:00:00 EDT
sure, changed