Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get URL currently displayed by browser?

12 views
Skip to first unread message

Helmut Giese

unread,
Mar 1, 2006, 5:48:26 PM3/1/06
to
Hello out there,
I would like to be able to ask the user's browser what URL it is
currently showing. (I cannot ask the user since he/she doesn't always
know: When navigating in a site the current address isn't necessarily
displayed.)
I seem to remember that this topic came up here a couple of times, but
a search on groups.google.com and the wiki didn't turn up anything
useful.
Anybody out there with a better memory then me? Or greater
capabilities in formulating search criteria? Or just plainly _knowing_
it?
Any advice or link will be greatly appreciated.
Best regards
Helmut Giese

David Gravereaux

unread,
Mar 1, 2006, 6:08:52 PM3/1/06
to


Years ago, in a land far far away, there was some public exposed API
that used DDE to communicate to "the" browser [windows of course].

I have since lost all such knowledge..

David Gravereaux

unread,
Mar 1, 2006, 6:11:01 PM3/1/06
to

David Gravereaux

unread,
Mar 1, 2006, 6:13:12 PM3/1/06
to

Michael Schlenker

unread,
Mar 1, 2006, 9:53:42 PM3/1/06
to
Helmut Giese schrieb:

For IE you can get this info by using tcom and the COM interface.
For Mozilla/Firefox etc. i don't really know, a mozilla chrome/xul
extension can do it (i have one that tracks the currently visited
website in a browser and sends it and some extra info to a tclhttpd via
SOAP. The server then sends the next page to show in the browser, kind
of remote controlled webpage show...)

Michael

Helmut Giese

unread,
Mar 2, 2006, 9:08:09 AM3/2/06
to
On Wed, 01 Mar 2006 15:08:52 -0800, David Gravereaux
<davy...@pobox.com> wrote:

>Helmut Giese wrote:
>> Hello out there,
>> I would like to be able to ask the user's browser what URL it is
>> currently showing. (I cannot ask the user since he/she doesn't always
>> know: When navigating in a site the current address isn't necessarily
>> displayed.)
>> I seem to remember that this topic came up here a couple of times, but
>> a search on groups.google.com and the wiki didn't turn up anything
>> useful.
>> Anybody out there with a better memory then me? Or greater
>> capabilities in formulating search criteria? Or just plainly _knowing_
>> it?
>> Any advice or link will be greatly appreciated.
>> Best regards
>> Helmut Giese
>

Hi David,


>Years ago, in a land far far away, there was some public exposed API
>that used DDE to communicate to "the" browser [windows of course].
>
>I have since lost all such knowledge..

Too bad :(
But many thanks for supplying the 2 links. It turned out to be useful
to associate 'DDE' and 'browser' or 'Netscape' to get some useful
information. It's as easy as
package require dde
set browser IEXPLORE ;# or FIREFOX or NETSCAPE
set data [dde request $browser WWW_GetWindowInfo 0xFFFFFFFF]
set url [lindex [split $data ","] 0]
but the results are somewhat disappointing: I only get the "start
page" (as displayed in the address field), but what I want is the
_real_ URL the user navigated to, which contains stuff like
...year=2006&month=03&day=02...
which apparently is provided by a script within the page.
Hm, this needs more hunting around.
Best regards
Helmut Giese

Helmut Giese

unread,
Mar 2, 2006, 9:10:58 AM3/2/06
to
On Thu, 02 Mar 2006 03:53:42 +0100, Michael Schlenker
<sch...@uni-oldenburg.de> wrote:

>Helmut Giese schrieb:
>> Hello out there,
>> I would like to be able to ask the user's browser what URL it is
>> currently showing. (I cannot ask the user since he/she doesn't always
>> know: When navigating in a site the current address isn't necessarily
>> displayed.)
>> I seem to remember that this topic came up here a couple of times, but
>> a search on groups.google.com and the wiki didn't turn up anything
>> useful.
>> Anybody out there with a better memory then me? Or greater
>> capabilities in formulating search criteria? Or just plainly _knowing_
>> it?
>> Any advice or link will be greatly appreciated.

Hi Michael,


>For IE you can get this info by using tcom and the COM interface.
>For Mozilla/Firefox etc. i don't really know, a mozilla chrome/xul
>extension can do it (i have one that tracks the currently visited
>website in a browser and sends it and some extra info to a tclhttpd via
>SOAP. The server then sends the next page to show in the browser, kind
>of remote controlled webpage show...)

tcom sounds interesting - especially since using DDE didn't produce
what I need (see my answer to David).
Ok, let's hunt for tcom & Netscape/Firefox/IE.
Best regards
Helmut Giese

David Gravereaux

unread,
Mar 2, 2006, 1:14:47 PM3/2/06
to


Darn.. appears to work right with firefox:

% set data [dde request $browser WWW_GetWindowInfo 0xFFFFFFFF]
"http://www.potentiometers.com/rnpushselect.cfm?session_num=2006030209473545","Push-Fit
Control Knobs - Selection Guide",""

Helmut Giese

unread,
Mar 2, 2006, 5:05:35 PM3/2/06
to

Hi David,
with this site it works for me, too.
One difference I notice: At this site the current URL is displayed in
the address field - with all query parameters included.
At the site I'm interested in, the address field _always_ shows the
base URL - and that's what I get back.

But I found a work-around: If I right-click into the frame of interest
and choose 'display current frame' I get the display _and_ I get this
frame's URL in the address field, too - and then I can retrieve it
with the script above.
Seems to me that Firefox always returns what it shows in the address
field. For the moment this is good enough - if the customer feels he
needs something better, there is XPCOM to explore.

BTW with IE I can talk via tcom (really an excellent package) and get
what I want - with the minor annoyance that I cannot reach an already
running instance, but have to launch a new one - well, that's life.
Thanks for your interest and best regards
Helmut Giese

0 new messages