Forum Discussion

tim_espasandin's avatar
tim_espasandin
Occasional Contributor
11 years ago
Solved

Identifying active page in Firefox

I'm using a piece of code to return the URL of the active tab on the selected browser. It looks like this:



Sys.Browser(browser).FindChild(["ObjectType", "Visible"], ["Page", true]).URL;



This works fine when browser is Chrome or IE, but when browser is Firefox, this line will return, "chrome://browser/content/browser.xul" It looks like I'll need to tweak my code to exclude this page, so that the code will find the active tab, like it was supposed to.



For the moment, I'll put together a switch to search firefox differently, but my script would be easier to read if I just add another item to the FindChild method. Does anyone know a property that will work for this?

  • You could use the name property with a wildcard



    Sys.Browser(browser).FindChild(["Name", "Visible"], ["Page*", true]).URL


2 Replies

  • paul_scroce's avatar
    paul_scroce
    Frequent Contributor


    You could use the name property with a wildcard



    Sys.Browser(browser).FindChild(["Name", "Visible"], ["Page*", true]).URL