Get the URL of the current (active) browser tab

Post your working scripts, libraries and tools
User avatar
JnLlnd
Posts: 297
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: Get the URL of the current (active) browser tab

05 Aug 2018, 16:14

AHKStudent wrote:in chrome 67 and 68 if you have a new tab window as the main window this wont work

to test click to get a new tab in chrome and then run to get list of windows, u will get blank even if you have 5 other regular websites opne
@AHKStudent: If we are talking of the same function GetActiveBrowserURL(), this function retrieves the active tab's URL. What you describe is not an error since there is no URL to retrieve in a blank tab.

@atnbueno: I hope you or another wizard here will be able to look into the Firefox issue...
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
Johnny R
Posts: 269
Joined: 03 Oct 2013, 02:07

Re: Get the URL of the current (active) browser tab

09 Aug 2018, 02:35

No atnbueno, no solution. Where is atnbueno?
Johnny R
Posts: 269
Joined: 03 Oct 2013, 02:07

Re: Get the URL of the current (active) browser tab

18 Aug 2018, 08:09

I've reinstalled the newest version of the script and the problem was solved. The script works fine with Firefox v61.0.2. Thank You all!
User avatar
JnLlnd
Posts: 297
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: Get the URL of the current (active) browser tab

19 Aug 2018, 13:22

I confirm. This works with Firefox v61.0.2:
https://autohotkey.com/boards/viewtopic ... 81#p182981
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
hotkeyguy
Posts: 147
Joined: 11 Oct 2014, 12:22

Re: Get the URL of the current (active) browser tab

22 Oct 2018, 08:20

I'm using JnLlnds code. With Firefox 62.0.3, I get sometimes two error messages
1. An error occurred in the secure channel support
followed by
2. The data necessary to complete this operation is not yet available.

The affected lines are objWebRequest.Send() ; and return (objWebRequest.StatusText() = "OK" ? objWebRequest.ResponseText() : "") in function Url2Var(strUrl):

Code: Select all

;------------------------------------------------------------
Url2Var(strUrl)
;------------------------------------------------------------
{
	objWebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
	/*
	if (A_LastError)
		; an error occurred during ComObjCreate (A_LastError probably is E_UNEXPECTED = -2147418113 #0x8000FFFFL)
		BUT DO NOT ABORT because the following commands will be executed even if an error occurred in ComObjCreate (!)
	*/
	objWebRequest.Open("GET", strUrl)
	objWebRequest.Send() ; <== ERROR 1

	return (objWebRequest.StatusText() = "OK" ? objWebRequest.ResponseText() : "") ; <== ERROR 2
}
;------------------------------------------------------------
That happens e. g. with GitHub pages, like GitHub - nshalabi/SysmonTools: Utilities for Sysmon.
I assume that's an certificate validation issue? I tried Sleep instructions without success.


Many thanks for all your efforts and any hints
hotkeyguy
User avatar
JnLlnd
Posts: 297
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: Get the URL of the current (active) browser tab

22 Oct 2018, 08:41

Hi,

> I'm using JnLlnds code. With Firefox 62.0.3, I get sometimes two error messages

I tried only a few times but it worked with the same Firefox version.

BTW, I worked on in but I'm not the one who wrote the "core" of the code. It is from atnbueno.

Jean
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
freespacing
Posts: 97
Joined: 28 Sep 2016, 11:14
Contact:

Re: Get the URL of the current (active) browser tab

21 Feb 2019, 09:43

Spanish version just because…
¡Hola atnbueno!
Gracias por el post con todo lujo de detalles.
Por casualidad ¿tendrías alguna sugerencia para Pale Moon?
De costumbre lo hago con JS dentro de Dorando o GreaseMonkey, pero me resultaría sumamente útil hacerlo en ahk.
Gracias y hasta pronto.

English because that's this board's language
Hello atnbueno!
Thanks for the post full of details.
Do you by any chance have any suggestions for Pale Moon?
I usually do it with JS inside Dorando or GreaseMonkey, but it would be extremely useful to do it in ahk.
Dest938572
Posts: 3
Joined: 28 Dec 2015, 06:02

Re: Get the URL of the current (active) browser tab

02 Jul 2019, 08:36

atnbueno wrote:
08 Jun 2014, 13:19

Short version: The code below finds out the URL of the current (active) browser tab for most of the modern browsers.
Awesome script, thank you Antonio.
It works perfect more than 5 years.
The shape and solutions of the future depend totally on the collective effort of all people working together.
© Jacque Fresco
tdalon
Posts: 9
Joined: 21 Apr 2017, 07:19
Google: thierrydalon
GitHub: tdalon

Re: Get the URL of the current (active) browser tab

18 Nov 2019, 04:00

Hi Antonio
I have noticed an issue (Win10) with Internet Explorer.
If I have multiple windows opened, it returns the url of the first opened window and not the one where I have the focus on.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Google [Bot] and 37 guests