admin管理员组文章数量:1419182
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
1 Answer
Reset to default 3document.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/
本文标签: javascriptCannot get tab titleStack Overflow
版权声明:本文标题:javascript - Cannot get tab title - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745304236a2652550.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论