Is it possible to use JavaScript to change the meta-tags of the page?

后端 未结 18 1148
后悔当初
后悔当初 2020-11-22 14:14

If I put a div in the head and display:none, than use JavaScript to display it, will this work?

Edit:

I have stuff loaded in AJAX. And as my AJAX changes the

18条回答
  •  长情又很酷
    2020-11-22 14:40

    Yes, you can do that.

    There are some interesting use cases: Some browsers and plugins parse meta elements and change their behavior for different values.

    Examples

    Skype: Switch off phone number parser

    
    

    iPhone: Switch off phone number parser

    
    

    Google Chrome Frame

    
    

    Viewport definition for mobile devices

    
    

    This one can be changed by JavaScript. See: A fix for iPhone viewport scale bug

    Meta description

    Some user agents (Opera for example) use the description for bookmarks. You can add personalized content here. Example:

    
    Test
    
    
    
    
    
    
    

    So, it’s not just about search engines.

提交回复
热议问题