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 - override .js file
How to track DOM change in chrome extension?
Reloading the content script
How to get chrome to run extensions automatically?
Toggling Google Chrome extension popout
chrome extension what's the use of argument: tabld?
Google Chrome crashes without any log
Chrome extensions: is it possible to call a function in the options page from the background page?
Capturing resource size in a Chrome extension
How to generate the appID for a Google Chrome Extension [duplicate]
Get local file inside the extension folder in Chrome
How do I use Chrome's history API to search for visits matching a given URL?
saving username password in option.html and loading them automatically
input type=“file” is not opening the file browser from Chrome Extension
packed chrome extension loses manifest on restart
How does Google Chrome launch Internet Explorer in the IETab extension

Categories

HOME
twitter
google-chrome-extension
zeromq
urbancode
pycharm
json.net
bookshelf.js
getelementsbytagname
cvs
setup-deployment
malloc
alpha
mvvmcross
wamp
fancybox-3
numeral.js
quickbooks
resize
django-simple-history
workload-scheduler
finite-automata
reactcsstransitiongroup
undefined
sms-gateway
beyondcompare
lucene.net
karma-jasmine
amazonsellercentral
paging
opencover
errorlevel
functional-testing
trading
p-value
react-css-modules
tasklet
airconsole
copying
code-contracts
kendo-ui-grid
uiswipegesturerecognizer
file-format
x11-forwarding
multilingual
ansible-playbook
angularjs-factory
broadcastreceiver
eclipse-scout
pdf-reactor
nxlog
auto-update
dotcover
rainbowtable
jquery-validate
pearson
arrow-keys
sqldf
dynamics-sl
messenger
grails-tomcat-plugin
fuzzy-search
connect-by
prettytensor
qcustomplot
php-parse-error
asp.net5
purge
coveralls
splash
operation
device-orientation
umbraco6
tt-news
phalanger
cctv
internet-connection
neolane
dir
sitemesh
xamlparseexception
mqx
google-email-migration
appconkit
whoosh
invite
visitor-statistic
w3wp.exe
blitz++
coda-slider
suppress
procedural-music
zune

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