javascript - Cannot get tab title - Stack Overflow

I am working on a browser extension for which I need to know the current tab title. I manage to find th

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.

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.

Share Improve this question asked Nov 22, 2013 at 20:04 Vlad VladVlad Vlad 1322 silver badges13 bronze badges 5
  • What "tab" are you talking about? Your 2 examples are COMPLETELY different! One is about jQuery UI tabs and the other is the browser's tab. What exactly are you trying to get? Where are you trying to access it? What is ui? – gen_Eric Commented Nov 22, 2013 at 20:14
  • @RocketHazmat , browser's tab. – Vlad Vlad Commented Nov 22, 2013 at 20:16
  • What browser are you making an extension for? – gen_Eric Commented Nov 22, 2013 at 20:18
  • Firefox at the moment. – Vlad Vlad Commented Nov 22, 2013 at 20:19
  • 2 Firefox extensions use a different method of accessing tab titles. For Firefox, see: addons.mozilla/en-US/developers/docs/sdk/latest/modules/sdk/… (Chrome is petently different) – gen_Eric Commented Nov 22, 2013 at 20:24
Add a ment  | 

1 Answer 1

Reset to default 3

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/56deD/

http://jsfiddle/56deD/show/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745304236a4621615.html

相关推荐

  • javascript - Cannot get tab title - Stack Overflow

    I am working on a browser extension for which I need to know the current tab title. I manage to find th

    7小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信