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.webNavigation.getAllFrames does not say if IFrame is hidden
Stop window.location execution in global context
Passing urls from content to background
Chrome disables extension — how to understand why?
Chrome Extension new price
Rent Access to Chrome Extension?
YouTube embedded video inside Chrome extension page appears as back rectangle in Chrome 56
A way to make onDeterminingFileName and NativeMessaging work together
is there no more new chrome extension are allowed to publish for chrome browser?
Chome Extension - QuotaExceededError localStorage
Is it possible to require npm modules in a chrome extension ?
How to get content from new tweet before submit button is pressed?
Reload background script from popup?
How to get public redirectURL of chrome extensions for oauth?
Porting Firefox Add-on to Chrome Extension
Chrome devtools extension - How to open elements panel with element selected

Categories

HOME
java
raspberry-pi
office365api
razor
v8
acquia
wamp
django-imagekit
azure-storage-tables
podio
upload
cross-validation
iggrid
imacros
correlation
google-cloud-spanner
usergrid
remote-access
carthage
openrefine
conemu
visjs
xlsxwriter
realex-payments-api
kudan
language-agnostic
php-openssl
restful-authentication
jndi
fish
maxmind
maquette
ejabberd-module
delicious-api
copying
typed.js
pim
azure-sql-database
accelerate-framework
mpmediaquery
stacked
janrain
nomethoderror
midl
modelmapper
.net-4.6.2
thin
wso2carbon
dds
hendrix
domain-model
magma
android-cursor
dtexec
sybase-asa
cubes
time-and-attendance
parallel-data-warehouse
jquery-filter
grails-tomcat-plugin
elements
py2app
google-web-starter-kit
ctest
lua-5.1
apachebench
suffix-tree
independentsoft
browser-link
metaclass
iis-arr
drawbitmap
createprocessasuser
e10s
jsapi
sorl-thumbnail
tt-news
markers
navigationservice
jquery-layout
ember-charts
google-cloud-save
dbconnection
ril
mylyn
sabredav
delphi-6
tinn-r
sublist
parametric-equations
reddot
data-loss
vdsp
calling-convention
disclosure
imac
html-input
castle-monorail
thunderbird-lightning
web-architecture
swing-app-framework
temporal-database
noscript
w3wp
uiq3

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