Hello everyone.
Short version: The code below finds out the URL of the current (active) browser tab for most of the modern browsers.
Long version:
How to get the URL of the browser tab I'm using? The problem is quite common and there have been several scripts to tackle it here in the forum.
The best solution for quite sometime (IMHO) was Sean's DDE code but unfortunately Google Chrome doesn't support DDE. Recent changes to Chrome invalidated the Chrome_OmniboxView workaround so I didn't knew how to get it until I saw uname's use of the ACC library (Sean strikes again ). uname's code depended on the language used in Windows (I use Win7 x64 in Spanish) but I found out a workaround. I even managed to extend my solution to cover Chromium-based browsers (like the new Opera), and even got it to work in Maxthon.
Anyway, the code below finds out the URL of the current (active) browser tab. I've tested it successfully (on Win7 x64 Spanish) with the following browsers:
- Google Chrome 46
- Mozilla Firefox 41
- Internet Explorer 11
- Opera 32
- Microsoft Edge 20
- Opera 12
Google Chrome 37-38 (Canary)- Maxthon 4.4
- Iron 45
- Coowon 1.6.8.0
CoolNovo 2.0.9.20- Slimjet 5.0.11.0
I'd appreciate any feedback, particularly if it DOESN'T work
Download: GetActiveBrowserURL.ahk
See the current script in the new board: https://autohotkey.com/boards/viewtopic.php?t=3702
Regards,
Antonio
EDIT 2014-06-17:
- Faster in Chromium browsers: After the first use, successive queries are instantaneous (faster than DDE!) Thanks to XeroByte for the nudge ;-)
- Improved error messages in the hotkey example
- Tested without problems in all AutoHotkey versions (U32, A32, U64) and also in Windows 8.1
EDIT 2014-07-05:
- Now it works with CoolNovo (blame Kudos ) and (probably) any other Chromium-based nested-window browsers
EDIT 2014-10-18:
- Now it works with Microsoft Edge (only tested via VM) and Slimjet (both suggestions by Kudos)
- Better URL detection (thanks LarryC for the feedback)
- Added workaround for runtime errors suggested by Kipp (in the old forum) a year ago
- Removed support for Google's failed Origin Chip experiment
EDIT 2015-12-31:
- This board will be read-only from now on. Development of this script will continue in the new board: https://autohotkey.c...opic.php?t=3702