Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Hyperlink in Web Browser and ActiveXControl
Date: Tue, 27 Jan 2009 08:49:03 +0000 (UTC)
Organization: TACT Computer Systems Ltd
Lines: 20
Message-ID: <glmhpv$7if$1@fred.mathworks.com>
References: <famka8$5k7$1@fred.mathworks.com> <famovi$l5o$1@fred.mathworks.com> <famppt$4q8$1@fred.mathworks.com> <faq1j7$pj0$1@fred.mathworks.com> <fatt20$cuj$1@fred.mathworks.com> <glmeqc$gt2$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1233046143 7759 172.30.248.35 (27 Jan 2009 08:49:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 27 Jan 2009 08:49:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 642467
Xref: news.mathworks.com comp.soft-sys.matlab:514168


> 1. I need to know the way to get the selected text in the html file. I mean that if i would select some text using mouse in the displayed html file. How do i get it? what's the way from browser data structure.

url = 'www.cnn.com';
browser = com.mathworks.mlwidgets.html.HTMLBrowserPanel(url);
pos = [10,10,400,300];
javacomponent(browser,pos,gcf);

browserCanvas = browser.getHTMLRenderer.getComponent(0).getComponent(0);
browserCanvas.getSelectedText;

> 2. If i display the multiple html files in the same browser, I need to switch between the html file without refreshing(It's mandatory). Of course, I can addToolbar where i can click Back and Forward buttons, But i need an API to invoke Back and Forward

browser.setCurrentLocation('www.bbc.com');
browserCanvas.goBack;      % =>CNN, use browserCanvas.getURL to check
browserCanvas.goForward;  % =>BBC, use browserCanvas.getURL to check

The exact methods/properties of browserCanvas may depend on your default browser.

Yair Altman
http://ymasoftware.com