i created a chrome extension that close the pop up window on click of a button in that window..

2,297 views
Skip to first unread message

Prashant

unread,
Jul 1, 2016, 3:12:21 AM7/1/16
to Chromium-Extensions-Announce
I am trying to get the url of all the open tabs and when the url matches with the callback url , i am closing that window with tab.remove but it is working fine on windows but not in mac.
Please suggest any solution...

Prashant

unread,
Jul 1, 2016, 8:26:31 AM7/1/16
to Chromium-Extensions-Announce
Here is my code..

if (loginWindow) {               
                //Creating an interval to detect popup window location change event
                interval = setInterval(function () {                   
                    //get the url of all the open window
                    chrome.tabs.query({
                    active: true,
                    currentWindow: true
                    },function(tabs){    

                    var tabURL = tabs[0].url;
                    var p=tabs[0].url.id;
                console.log(tabURL);
                    if ((tabURL).indexOf(that.callbackURL) == 0)
                    {
                         chrome.tabs.remove(p);
                            clearInterval(interval);
                            that.oauthCallback('#' + tab.url.split('#')[1]);
                    }                                   
                });
                if (loginWindow.closed) {
                        clearInterval(interval);
                    }
                }, 250);

Antony Sargent

unread,
Jul 6, 2016, 3:42:28 PM7/6/16
to Prashant, Chromium-Extensions-Announce
Your code doesn't show where "that.callbackURL" gets initialized - is it possible that somehow it isn't set properly at the time that you check if tabURL starts with that string?


--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/3ea87990-edd4-457c-bfd4-d8737e6bb8dc%40chromium.org.

Prashant

unread,
Jul 8, 2016, 3:24:35 AM7/8/16
to Chromium-Extensions-Announce
Got it working, thanks


On Friday, July 1, 2016 at 12:42:21 PM UTC+5:30, Prashant wrote:
Reply all
Reply to author
Forward
0 new messages