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

How can I add a click for pageAction?
How to detect view-source scheme in Chrome Extension
captureVisibleTab text rendering is blurry
Chrome Tab creation Limit to 3 only?
chrome.app.window resize to smaller dimensions
Is it possible to increase chrome.bookmarks.MAX_WRITE_OPERATIONS_PER_HOUR?
How to correctly write new “event page” for chrome extensions?
How long before stats and ratings display for new Chrome Extensions in Web Store? [closed]
Chrome Extension: Permissions to manipulate content of data URIs
REST API and login outside meteor application
chrome api: delete omnibox history
How to get access to functions written in Chrome extension from the JS dev console?
How to move a tab after the last pinned tab?
Browser Extension the “Injected way” a cross-browser extension that include a JS from a distant server
Chrome Sockets API Behaves Differently on Chrome OS (vs. Ubuntu, Windows)?
bookmarks bar click event listener chrome extension

Categories

HOME
maven
java
wso2-am
cloud
atom-editor
gerrit
single-sign-on
mfc
google-api-php-client
read-eval-print-loop
at-command
twitter-bootstrap-4
c#-2.0
pivotal-cloud-foundry
constraint-programming
add
ssl-client-authentication
vault
tomcat6
node-pdfkit
midi
modelica
circular-dependency
saxon
undefined
samoa
jprofiler
custom-wordpress-pages
autocad-plugin
visjs
errorlevel
google-search-api
autosys
p-value
numerical-methods
pepper
web-api-testing
strncpy
fog
vsts-build-task
rotational-matrices
mapbox-gl
bower-install
revolution-slider
appfabric
bitbucket-pipelines
splice
businessworks
rainbowtable
scrollable
strptime
veracode
pg-dump
akka-cluster
hittest
mediaelement
setuptools
gridpane
android-textview
nsfilemanager
mathematica-frontend
nsviewcontroller
skype4py
dataview
pyke
vhd
rgeo
0xdbe
cakephp-3.1
ios9.1
method-parameters
event-bubbling
web-controls
truevault
apache-commons-net
python-green
gui-test-framework
php-5.4
starcluster
valuechangelistener
ms-project-server-2010
ora-00911
gwt-rpc
hungarian-algorithm
ember-app-kit
jquery-knob
path-separator
dice
manchester-syntax
automount
cufon
eclipse-templates
fireworks
self-extracting
suppress
preference
thunderbird-lightning
memory-size
data-acquisition
windows-live-messenger
ajax-forms

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