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

Keep alive processing after close the google extension “popup”
chrome extension how do I inject javascript code to the chrome setting pages “chrome://inspect/#device”? [duplicate]
console.log - Chrome extension doesn't execute console.log, it just skips console.log [duplicate]
Firefox Addon - Send message from webpage to background script
Chrome extension localization in manifest not working
popup.html view not updating the newly assigned values of $scope variables in controller in popup.js
I need to connect my existing chrome extension to firebase .could anyone pls suggest a new way?
error while sending message from extension script to content script
how to customize rightclick on chrome devtools elements panel
Chrome extension custom payment solution in Pakistan?
How to get support tab for Google Chrome extension
How to Log to Console from Chrome Extension?
Chrome Extension - Detecting New Posts on a 4chan thread
Chrome Extension Template (Regex Filter) needed
Tricking a javascript code to think it has a focused window?
my extension keep getting rejected and i don't know why

Categories

HOME
clips
netbeans
minimum-spanning-tree
mockito
lodash
kalman-filter
adb
microservices
twitter-bootstrap-4
c#-2.0
facebook-messenger-bot
elasticsearch-hadoop
communication
user-input
zend-framework3
fallback
ibm-odm
quickfix
apache-metamodel
reactcsstransitiongroup
jqwidget
reverse-proxy
restful-authentication
trading
firebase-crash-reporting
sqlcipher
status
facebook-access-token
uninstall
strncpy
jaxb2
windows-server-2000
airconsole
siesta-swift
winrt-xaml-toolkit
column-family
xmlreader
amazon-kinesis-kpl
overriding
graphenedb
firebase-admin
qcombobox
google-datalayer
youcompleteme
jedis
domain-model
powercli
sybase-asa
boost-preprocessor
namecoin
imanage
django-scheduler
ableton-live
static-ip-address
httplistener
radtreelist
py2app
nsfilemanager
ctest
moveit
dlna
livequery
design-by-contract
ford-fulkerson
natvis
reactive-banana
icu4j
qdialog
retina
wordml
angular-leaflet-directive
operation
apache-commons-fileupload
createprocessasuser
graph-api-explorer
codeigniter-url
document-classification
flask-cors
article
poller
multiprocessor
seed
distutils
hamiltonian-cycle
rdoc
nsmanagedobject
netbeans-6.9
code-cleanup
assembly-loading
window-management
coercion
f#-powerpack
self-extracting
actionview
sql-server-profiler
xfbml
lang
sudzc
pascal-fc
mediarss
ubuntu-9.04
data-acquisition
3gp
ntvdm.exe

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile