google-chrome-extension


How do we get the parent tab URL of the current chrome tab?


On my application home page, there is a link which opens a new tab when clicked.
After some research, I found below code which gets triggered when a new chrome tab is launched. The "active_tab" object below gives information about the current tab.
But how do we get the Parent tab URL (previous active tab) here ? Please help.
I need to get my Home page url here from which this active_tab is launched.
chrome.tabs.onActivated.addListener(function(activeInfo) {
chrome.tabs.get(activeInfo.tabId, function(active_tab){
alert(active_tab.url);
/* code */
});
});
Thanks #wOxxOm.
Used the openerTabId property to get parent tab.
chrome.tabs.onActivated.addListener(function(activeInfo) {
chrome.tabs.get(activeInfo.tabId, function(active_tab){
chrome.tabs.get(active_tab.openerTabId, function(parent_tab){
alert(parent_tab.url);
});
});
});

Related Links

What does input_components do in a Chrome extension manifest?
Project Guidance - Chrome Extension to Synchronize Bookmarks
Copy - Paste Clipboard (Right Click Menu) - Google Chrome
What is “platforms” for in manifest.json?
Does chrome extension have listener for chrome toolbar like back/forward/refresh button and address bar?
Chrome extension that performs animation where the user clicks
Which program do you highly suggest for google extension silent install? [closed]
How to set React component state and props from browser
How to apply styling to panel, created with chrome.devtools.panel.create in your own chrome extension?
Firebase's getAuth() across multiple urls
launch chrome extension from command line
Chrome USB API interruptTransfer failed
What is the use of different OnBeforeRequestOptions and OnHeadersReceivedOptions?
Correct way of sending updates from Content Script to Popup
Chrome extension : how to detect click in background process?
pagination Chrome web scraper

Categories

HOME
multithreading
keycloak
kde
fft
session
octobercms
read-eval-print-loop
jsp-tags
tizen-web-app
electronics
ip
alpha
fingerprint
acquia
adfs
midi
offline
timeout
netflix
serverless-framework
clojurescript
telephony
solaris-10
sms-gateway
alpine
tar
csrf-protection
wijmo
crosstab
centos6.5
selectedindexchanged
info.plist
assistant
socialengine
iframe-resizer
grails-3.1
commit
phpfreechat
textmate
language-concepts
rotational-matrices
normal-distribution
wixsharp
git-merge
qwerty
xcode-extension
android-browser
reportbuilder
gzipstream
ibpy
firebase-admin
menuitem
user-accounts
revapi
jedis
multipeer-connectivity
python-webbrowser
veracode
tropo
snmptrapd
google-perftools
dtexec
flow-control
orthogonal
crosswalk-runtime
mediaelement
pycaffe
pintos
ableton-live
transmitfile
qgraphicsview
ios4
system.management
natvis
python-3.2
dukescript
createprocessasuser
dereference
rake-task
websocket4net
internet-connection
php-5.4
uitouch
funcunit
wp-query
openlaszlo
mysqltuner
c18
xsockets.net
access-rights
opcache
plasma
simba
onsubmit
php-parser
zpt
coercion
psi
xmlspy
self-extracting
propagation
blitz++
wise
microsoft-virtualization
yagni
mediarss

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App