homepage Welcome to WebmasterWorld Guest from 54.237.213.31
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Jquery Dynamic Title
webfoo

5+ Year Member



 
Msg#: 4473313 posted 6:04 pm on Jul 6, 2012 (gmt 0)

I need to change the title of Page A based on some content within Page B. Page B will have different content every time.

Page A
<html>
<head>
<title>Default Title</title>
<script type='text/javascript>
jquery script to load entire contents of Page B into #dynamic_part and refresh it frequently
</script>
</head>
<body>
<div id='dynamic_part'></div>
<div id='static_part'>Lorem Ipsum</div>
</body>
</html>


Page B
<div>blah blah</div>
<div>Content I need for the title</div>


Ideas?

 

daveVk

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4473313 posted 12:13 am on Jul 9, 2012 (gmt 0)

<div id="newTitle">Content I need for the title</div>

after loading content

document.title = $("#newTitle").html();

webfoo

5+ Year Member



 
Msg#: 4473313 posted 3:17 pm on Jul 11, 2012 (gmt 0)

Perfect! Thanks a lot.

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4473313 posted 4:18 pm on Jul 11, 2012 (gmt 0)

One has to wonder why you need this; the title tag serves a Very Important Purpose in respect to SEO, and the Javascript is not likely to execute for search engines (i.e. the title will be "Default Title" for all these pages in SERPS.)

webfoo

5+ Year Member



 
Msg#: 4473313 posted 6:11 pm on Jul 11, 2012 (gmt 0)

Yes I understand that rocknbil. But this okay for a number of reasons. First, I don't want or need this site to be found in a search engine. Second, the purpose of the dynamic title is to alert the user to new content if they are focused on a different window. Sort of like Gmail changes the title when you have a new chat message.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved