Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. How to add or change meta tag by javascript at runtime

How to add or change meta tag by javascript at runtime

Scheduled Pinned Locked Moved Web Development
javascripttutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shames Sam
    wrote on last edited by
    #1

    I have to add meta tag in aspx page by javascript at run time when page is load, it is possible.

    Web Developer

    E M 2 Replies Last reply
    0
    • S shames Sam

      I have to add meta tag in aspx page by javascript at run time when page is load, it is possible.

      Web Developer

      E Offline
      E Offline
      Expert Coming
      wrote on last edited by
      #2

      shames(Sam) wrote:

      it is possible.

      Great! I have always wanted to do that!

      The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo

      1 Reply Last reply
      0
      • S shames Sam

        I have to add meta tag in aspx page by javascript at run time when page is load, it is possible.

        Web Developer

        M Offline
        M Offline
        Michael Hendrickx
        wrote on last edited by
        #3

        Don't know if it works in all browsers, but the following should do something:

        meta = document.createElement('meta');
        meta.name = "foo";
        meta.content = "bar
        document.getElementsByTagName('head').item(0).appendChild(meta);

        places.ae

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups