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 Extension icon not having color
Why is the right-click menu in the wrong place in the chrome extension options ui?
How to post reverse google search image with base64
Chrome extension onMessage listener not firing
What action can I take within an onBeforeRequest listener?
Mozilla WebExtensions start page
How to block Chrome extension popup on Amazon [closed]
content_security_policy not taking effect in Chrome Extension
multiple messages are recieved on content page when just one is sent?
Can a Chrome Extension read what is typed by the user in text boxes?
How does chrome extension require it's own resources?
autoclick on download icon, as soon as page loads
Is there a way to allow a Chrome extension content script to violate mixed-content rules?
Chrome Extension: Inject script on Dom loaded
Communicating between two chrome extensions
Why is the Chrome Web Store asking me to give out an email address and physical address publicly on my store page?

Categories

HOME
ibm-bluemix
pandas
testing
arduino-uno
jdo
dictionary
angular-material
relay
sd-card
alfresco
electronics
umd
angular-ui-bootstrap
ravendb
ezpublish
enterprise-library-5
amazon-cloudformation
medical
facebook-php-sdk
ssl-client-authentication
spring-kafka
moonmail
decimal
uitypeeditor
graphlab
solaris-10
predix
cultureinfo
internet-explorer-9
info.plist
filezilla
maxmind
elasticsearch-net
replaceall
wtx
jaxb2
newline
ecto
twilio-api
grails-3.1
accelerate-framework
y86
html5-fullscreen
disassembling
web-mining
jvm-languages
eigenvalue
isbn
btrace
xml-documentation
atomicity
python-c-api
pebble-watch
gabor-filter
dtexec
windows-mobile-6.5
arrow-keys
color-picker
trash
markojs
dataview
bluegiga
design-by-contract
cloudbees
cartesian-product
content-length
kcachegrind
ibaction
bridge.net
truevault
nsmutabledictionary
operator-precedence
c3
dd
codeigniter-url
gadt
applescript-objc
googlemock
funcunit
.aspxauth
dbconnection
file-locking
flashvars
jelly
cassini-dev
angularjs-controller
simba
frameset
javaspaces
qtkit
nsmanagedobject
code-cleanup
gnu-prolog
psi
self-extracting
krl
mongomapper
h.323
gamma
ncqrs
backcolor
gacutil
ugc
rtml

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile