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

Call a function of an extension / addon
chrome content script onclick event
Java to NPAPI for Chrome Extension
Cannot read property 'chromeExOAuthConfig' of null in Google Chrome Extension
Chrome, Firefox and Safari extension authenticate a computer
Triggering Heap profiling from Javascript?
Google Chrome extension - Webdb or IndexDB
How can a button in an iframe open a new url in a chrome extension
How to add new chrome user from extension? Is there any API available?
Chrome extension and selectionText. How does one create a tab and update the same tab repeatidly
Not able to see the thumbnail for my extensions in “chrome://settings/extensions” when I load a unpacked extension
webRequest api: does not handle requests to favicon.ico
How to set the initial dimensions of browser action popup?
C++ Binding: How to bind a c++ object to JS
SidebarPane on extension panel
innerHtml not working on extension popup

Categories

HOME
ionic-framework
osgi
cloud
wso2
mediawiki
platform-builder
bpmn
react-redux
ravendb
mvvmcross
android-youtube-api
webrequest
add
basic
gnupg
circular-dependency
fortumo
designer
netflix
django-admin
nhibernate-envers
textfield
dbext
plunker
physics-engine
excel-2007
realex-payments-api
mmap
su
status
react-css-modules
greendao
maxmind
windowbuilder
libssl
oracle-fusion-middleware
catch-all
cloud-code
mapdb
html5-fullscreen
nssegmentedcontrol
libvpx
leading-zero
ws-security
ensembles
ruby-on-rails-3.1
g-code
arena-simulation
gpx
node-sass
paxos
r-forge
bind9
sonarlint-vs
minimization
cubes
xcb
firmata
deadbolt-2
merge-conflict-resolution
clang-static-analyzer
rhino-servicebus
goose
revolution-r
simple-framework
feedback
iiviewdeckcontroller
csquery
modalpopup
clicktag
issuu
sgen
aapt
typo3-neos
pushbackinputstream
orchardcms-1.7
flashvars
jquery-knob
nsnetservice
cisco-jtapi
dsn
fireworks
stage
external-accessory
hamachi
floating
paster
infrastructure
sproutcore-2
firefox4
backcolor
ctp4
pascal-fc
genealogy
msdev
grid-system
wsdl.exe
signal-handling
rtml

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