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

Programatically determine path to Chrome Extensions folder
How to send trigger function in injected_scripts in devtools
How do I display Google reCAPTCHA v2 in a Chrome Extension browser action?
Don't want grayed out Chrome extension
In Chrome extensions, why use a background page with HTML?
Chrome capture visible tab gives messy result
Is it ok to repeatedly add event listener in the event pages for chrome extension?
Does Kendo UI support chrome apps/extentions?
Opening a New Window when Chrome Extension is Uninstalled
Chrome extension to redirect tab url
Chrome extension api chrome.sessions how to get session ID
Evaluate selection before showing context menu [duplicate]
How to detect ajax request which created by other extension content script
Change user-agent headers only in incognito mode with a Chrome extension
Keep alive processing after close the google extension “popup”
chrome extension how do I inject javascript code to the chrome setting pages “chrome://inspect/#device”? [duplicate]

Categories

HOME
twitter
xamarin
jdo
openstack
drivers
onedrive
webstorm
alfresco
infragistics
rubygems
ip
win32gui
mvvmcross
fancybox
in-app-purchase
node-notifier
iggrid
spring-tool-suite
jsprit
reactive-cocoa
beyondcompare
shared-hosting
java-3d
restful-authentication
angular2-aot
tdd
status
bootstrap-material-design
large-file-upload
preg-match
directx-10
nameservers
bosh
contact-form
perlin-noise
vsts-build-task
lxd
sequential
scaffold
unspecified
broadcastreceiver
android-tabhost
android-mediaprojection
bootstrap-dialog
rainbowtable
hibernate-tools
boost-multi-index
blogengine.net
dotnetzip
feeds
pearson
pillow
memory-alignment
yt-project
deadbolt-2
elements
gridview-sorting
markojs
persist
whois
cloudbees
netmq
t4mvc
cannon.js
myo
unity5.2.3
bridge.net
javax.mail
rake-task
c3
tt-news
angularjs-ng-click
xcode-6.2
rdl
terminfo
rtmfp
monomac
intentservice
ivyde
google-cloud-save
jquery-mobile-dialog
sabredav
enterprisedb
cassini-dev
clipper
kyotocabinet
e4x
bitsharp
twrequest
joyent
gdlib
site.master
gamequery
putchar
ubuntu-9.04
commodore

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