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

Create table and insert data in local storage of Chrome extensions
How can I trigger a content script to run when I click the popup icon of a Google Chrome extension?
How can I efficiently overwrite CSS with a content script?
Developer License Agreement required to develop Google Chrome Extensions [closed]
How to intercept a Javascript/CSS file request from the Webpage at the cleint side, and load alternative files insted?
Context menu API: Is there a way to know which button was used to select an item?
writing chrome extensions
Open and pass data to a popup (new tab) from content script
Do you know a Chrome / Firefox extensions using IndexeDB and Local storage?
Simple example for NPAPI plugin
Is there an archive for older versions of Chrome Extensions?
Determining frame URL for outgoing requests, using WebRequest API
how to change chrome extension owner email
Detect if a tab was POSTed to from Google Chrome extension
Should I own the site that I create Chrome Web App for?
From popup.html, how can I run a javaxcript function by button onclick?

Categories

HOME
twitter
openmp
netbeans
fluentd
appx
view
analysis
twitter-bootstrap-4
disassembler
windows-server
enterprise-library-5
applepay
facebook-php-sdk
adobe-analytics
export-to-csv
visual-studio-cordova
iron-router
clojurescript
libtiff
apache-metamodel
code-review
plunker
dcevm
angular2-aot
h2db
smb
underflow
virtualdub
gitignore
objectanimator
quote
microsoft-chart-controls
fabric8
uisplitview
avcapturesession
windows-dev-center
android-kernel
normal-distribution
host
simplexml
swisscomdev
swift3.0.2
service-discovery
vapor
ssjs
uft-api
dism
fakeiteasy
vao
btrace
cubic-spline
avconv
upstart
komodoedit
jedis
pubmed
rails-routing
celery-task
hls.js
linode
synchronous
visual-c++-2008
color-picker
gridpane
django-debug-toolbar
websitepanel
rvest
independentsoft
system.management
sdhc
arcanist
event-bubbling
graph-drawing
nsight
npapi
kineticjs
tween
angularjs-ng-click
relocation
issuu
mesa
kgdb
geos
jsctypes
spring-validator
angularjs-controller
first-responder
runas
javaspaces
jquery-ui-layout
remember-me
mirah
rescale
fixed-width
webkit.net
nerddinner

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App