Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'extracted': 0.05; 'python': 0.08; 'prefixed': 0.09; 'subject:URL': 0.09; '25,': 0.12; 'am,': 0.12; 'cc:addr:python-list': 0.15; 'subject:Current': 0.16; 'wrote:': 0.16; '(i.e.': 0.17; 'wed,': 0.17; 'jan': 0.19; 'seems': 0.19; 'cheers,': 0.20; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.25; 'windows': 0.26; 'all,': 0.27; 'tried': 0.27; 'received:209.85.220': 0.27; 'users.': 0.28; 'script': 0.28; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'bar.': 0.30; 'chris': 0.30; 'values': 0.32; 'there': 0.33; 'clarify': 0.34; 'running': 0.35; 'google': 0.36; 'received:google.com': 0.37; 'could': 0.37; 'some': 0.38; 'received:209.85': 0.38; 'received:209': 0.39; 'subject:: ': 0.39; 'browser': 0.61; 'your': 0.61; 'opened': 0.64; 'browsers': 0.67; 'william': 0.68; 'sender:addr:chris': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc :x-gm-message-state:content-type:content-transfer-encoding; bh=i5IDvTtxdT41mX4qvrFUZbKbOR59wL0Rsg1PgcyY0ko=; b=LUNKWqm709ODXu/6kGy0mO2kzKYsjRSgSdlIhw4fYf9DAQqxZHLyY+zl69psfgGHeU 0wx6CzVQoDUyZABqqyda+EelmQjEHdkNWBCa4krze8/hMYzEgSJklINiuUpBIePFgOyt e/2BVq3/PtLGI6TpHWhgmqRza3bMxuc6lmFX8= MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: <541734D3CD43B24FA1634A13C13C588D0313B3DC@IAD-WPRD-XCHB03.corp.verio.net> References: <541734D3CD43B24FA1634A13C13C588D0313B3DC@IAD-WPRD-XCHB03.corp.verio.net> Date: Wed, 25 Jan 2012 12:59:33 -0800 X-Google-Sender-Auth: gxSYwHwYfSyA494qHgGwIwSGmX0 Subject: Re: Current Web URL From: Chris Rebert To: William Abdo X-Gm-Message-State: ALoCoQk3oOLZar/ue9Cd76Nu+L7fBmfZSUuGES9cusn5XrkRJ9nkphreS9MtITn5fg1MSDh72t1d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1327525176 news.xs4all.nl 6918 [2001:888:2000:d::a6]:41896 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19433 On Wed, Jan 25, 2012 at 11:38 AM, William Abdo wro= te: > 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 =E2=80=9Cresponse =3D urllib2.urlopen('http://www.google.com= ').geturl()=E2=80=9D > however it seems to always to give me the google url and not the one in t= he > 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