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
arduino-uno
clips
push-notification
angular-material
homebrew
hp-exstream
vmware
spagobi
amazon-ecs
dxl
jxls
binary-tree
mvvmcross
azure-media-services
in-app-purchase
uber-api
amazon-cloudformation
applepay
communication
apache-cayenne
msp430
decimal
caml
conemu
cx-freeze
sylius
google-search-api
hammerspoon
h2db
pepper
subdomains
kendo-datasource
r-raster
http-status-code-503
lxd
windows-dev-center
plsql-psp
lto
withings
abstract-class
sqlite2
document.write
quadratic-programming
texmaker
powershell-dsc
android-mediaprojection
eigenvalue
scorm
apache-fop
dds
datastax-startup
colorama
slickedit
tactic
pg-dump
windows-iot-core-10
imanage
webdriverjs
mediaelement
url-pattern
instant
bonobo
multi-level
thrust
mathematica-frontend
plottable.js
qpid
firebaseui
pagedlist
ios4
prerequisites
tmuxinator
deis
responsive-images
unity3d-gui
bridge.net
javax.mail
gulp-less
android-radiobutton
meteor-velocity
algebraic-data-types
fmod
terminal-services
ms-project-server-2010
opcache
shellexecute
rabl
seed
random-seed
pvrtc
gil
google-email-migration
twrequest
ohm
code-cleanup
gnustep
stage
spyware
xmemcached
appender
actionview
remember-me
radcombobox
asp.net-mvc-areas
preference
ext3
substrings
brewmp
pascal-fc
nerddinner
grid-system
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