Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Using the h1 tag on a web page as the title using javascript

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #32094
    webguy
    Member

    I recently had the idea of using whatever was in the h1 tag on a website as the header using javascript as I thought it would allow me to create a template for my site that used the same basic html and so if I entered

    Home

    by using insert element

    in the I would be able to achieve this.

    First of all I am a beginner to javascript and am just wondering if you can

    -Use javascript in the
    -Do the whole

    =

    and let it still be SEO friendly

    note: i do not know if I have to use the insert element thing as I am just learning so its more of just a general interest in if this would be possible, even with another javascript thing

    #54507
    Johnnyb
    Member

    I don’t believe that it would be very SEO friendly, as when the bot sees the page it’ll just see an empty title tag, if anything that might have a negative effect on seo. The best way to do it would be using php, that way when the HTML comes back from the server it already has the content of the h1 tag inserted into the title. You would simply create a function that grabs the text from the h1 tag, and then call that function in the title.

    #54510
    webguy
    Member

    thanks, i’ll keep that in mind.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.