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

Chrome Extension - manifest matches read from localstorage?
Chrome extension inner file blocked in incognito mode
How to use google calendar API in an extension
Could we write a browser extension with which we could get control to addressbar without using any hotkeys?
How to match query parameters in the manifest.json in google chrome extension
Open tab from the icon clicked - chrome extension
Unable to access cookie value from onHeadersReceived
Chrome extension response undefined
Cancel Gmail auto save of draft programmatically
Problems injecting characters into some fields on some sites
Is there a way to abort a download from onDeterminingFilename
Call mutation observer after response received from background.js
youtube video added to chrome extension's web store listing displays black
Can I quickly revert to an older version of my chrome extension?
How to open a HTML file and have that replace the current popup? (Simple)
Send message from page 1 to page 2 using content script + background script

Categories

HOME
cakephp
pandas
webpack
debugging
isabelle
drivers
single-sign-on
hp-exstream
syntax
alfresco
bookshelf.js
getelementsbytagname
sqlite-net-extensions
spring-cloud-stream
jgroups
onelogin
directx
cross-validation
windows-10-universal
spring-xd
offline
dax
spring-tool-suite
vb.net-2010
iolanguage
transformation
invantive-sql
reactcsstransitiongroup
oracle-coherence
alpine
sqlcipher
javacv
pepper
log4js-node
delicious-api
fabric8
google-qpx-express-api
normal-distribution
mixture-model
optix
grid.mvc
no-www
http-redirect
total-commander
flashair
s
node-sass
komodoedit
python-webbrowser
return-value
dotnetzip
rdfs
togetherjs
elgg
libusb-win32
snmptrapd
boost-preprocessor
windows-iot-core-10
cudafy.net
linode
or-tools
word-vba-mac
android-fonts
passport-google-oauth
bonobo
player
qcustomplot
master-slave
thredds
service-accounts
lustre
c++03
offloading
gui-test-framework
fpml
id3v2
client-side-templating
internet-connection
sgen
contenttype
reactfx
transcoding
ember-charts
algebraic-data-types
ms-project-server-2010
sitemesh
odata4j
ruby-datamapper
html-editor
delphi-6
kyotocabinet
browser-detection
dmoz
newtonscript
amazon-appstore
asyncfileupload
work-stealing
ecl
pyinotify
sortable-tables
web-application-design
asp.net-profiles
firefox-5
sef





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