Current Web URL

Chris Rebert clp2 at rebertia.com
Wed Jan 25 15:59:33 EST 2012


On Wed, Jan 25, 2012 at 11:38 AM, William Abdo <william.abdo at verio.net> wrote:
> Hi All,
>
> I have been breaking my brains to find a solution to determining what the
> current URL is in a web browser navigation bar.
>
> It cannot be a prefixed values since I will not know what platform it is
> running from at the time it is opened by the users.
>
> Can this URL be extracted from the navigation bar so it can be parsed?
>
> I tried this “response = urllib2.urlopen('http://www.google.com').geturl()”
> however it seems to always to give me the google url and not the one in the
> navigation bar.

Could you clarify where the Web browser is running and where the
Python script is running in your situation?
Is the Web browser only notional (i.e. you just want to get the final
URL you would reach after requesting some given URL as if your script
were a browser)?
If no, what if there are multiple browsers or browser windows open?
Which URL bar would you want the URL from?

Cheers,
Chris



More information about the Python-list mailing list