Vlad Vlad
Vlad Vlad

Reputation: 132

Cannot get tab title

I am working on a browser extension for which I need to know the current tab title. I manage to find the title from the the HTML page code but, from after documenting more about this I have found that there are easier ways to do this.

I have tried the following ways:

selectedTabTitle = $(ui.tab).text(); 

and

selectedTabTitle = document.title;

but neither work. I must note that I am using kango-framework to make this extension.

Upvotes: 3

Views: 8995

Answers (1)

cytofu
cytofu

Reputation: 903

document.title should work or $('title').text()

are you maybe working with iframes? In that case the title of the iframe will be returned.

here an example:

first one shows the code, second one, so that it is not launched in an iframe

http://jsfiddle.net/56deD/

http://jsfiddle.net/56deD/show/

Upvotes: 3

Related Questions