Jak uzyskać tytuł strony HTML za pomocą JavaScript?
Jak mogę uzyskać tytuł strony HTML z JavaScript?
154
Author: Michał Perłakowski, 2009-06-29
3 answers
Użycie document.title
:
console.log(document.title)
<title>Title test</title>
252
Author: ZA.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-08-11 21:52:45
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-08-11 21:52:45
Włóż pasek adresu URL, a następnie kliknij enter:
javascript:alert(document.title);
Możesz wybrać i skopiować tekst z alertu w zależności od strony internetowej i używanej przeglądarki internetowej.
11
Author: No Mercy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-08-04 22:50:26
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-08-04 22:50:26
Można używać getElementsByTagName
var x = document.getElementsByTagName("title")[0];
alert(x.innerHTML)
1
Author: Vikram S,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-04-25 09:04:33
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-04-25 09:04:33