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

Making a Windows Installer communicate with a Chrome extension without NPAPI
Transfer the output of a chrome extension to a server
How Adobe Shadow Chrome Extension be able to catch dom changes without any relevant permissions in manifest?
it can not access popup.js file after creating a chrome extension
chrome.tabs.onUpdated.addListener not fired when page is retrieved from cache [duplicate]
Chrome extension: Show ballon notification with latest change log entries on update
Chrome extensions - Other ways to read response bodies than chrome.devtools.network?
Can I use “chrome://thumb/”, or capturing thumbnail without using “captureVisibleTab”?
Should I use content script of background page for my extension?
Chrome : Display image that when clicked launches external Windows app
Google Chrome Extension (v.17)
How to build an chrome extension like Google Hangouts
Chrome Extension run for a specific page
webNavigation.onCompleted fires when typing in address bar
Google Chrome Extension Confusion
Change Context Menu Icon

Categories

HOME
maven
variables
bluetooth
keycloak
mediawiki
lodash
cplex
analysis
sharepoint-designer
mvvmcross
yum
pheatmap
gorm
ssl-client-authentication
spring-xd
invantive-sql
reactcsstransitiongroup
object-detection
scriptcs
chromium-embedded
realex-payments-api
opennlp
buildbot
traffic
nhapi
fluentvalidation
ping
opentype
compatibility
jspm
procdump
librato
preg-match
socialengine
http-status-code-503
create-table
webtest
form-data
accelerate-framework
revolution-slider
serve
xcode-extension
libraries
mixture-model
c11
hp-ux
ruby-on-rails-3.1
g-code
acoustics
apache-fop
pango
veracode
integrity
colorama
carrot
worker-thread
specrun
passport-google-oauth
multiple-regression
nsviewcontroller
simplewebrtc
react-native-listview
pagedlist
intel-fortran
dundas
unity5.2.3
sonarqube5.1.2
graph-api-explorer
bigbluebutton
c3
tablelayout
phalanger
mysql-error-1062
concurrent-collections
soundtouch
coverflow
opcache
yui-compressor
lcs
robotics-studio
getmessage
genshi
javax.script
krl
lpeg
modelstate
caching-application-block

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