www.webdeveloper.com
Results 1 to 4 of 4

Thread: Removing/Inhibiting Meta Tag using JavaScript

  1. #1
    Join Date
    Jan 2011
    Posts
    3

    Red face Removing/Inhibiting Meta Tag using JavaScript

    Hello everybody, new here. I'm a complete JavaScript newbie, all I know is some HTML, CSS and little jQuery. Don't be so harsh :P

    I own and run a forum on a free software called **********. Since these people like getting a lot of revenue, they added a metatag that makes IE8 work like IE7. Here it is.

    Code:
    <!-- BEGIN meta_emulate_ie7 -->
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <!-- END meta_emulate_ie7 -->
    This works on only some pages on my forum. However, since we use a lot of CSS and JavaScript codes that IE7 doesn't support (but IE8 does), these pages are completely screwed up.

    Since they don't offer template editing for some versions (in which this tag can be found), I cannot simply delete this tag (unfortunately).

    I have come here to ask if there's any way to inhibit, remove, delete and destroy that stupid metatag which is screwing my forum up using JavaScript, jQuery, AJAX, or any other way (except PHP, since it's disallowed...) to do so.

    Any ideas? Any help will be absolutely appreciated. Thanks a bunch.

  2. #2
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,480
    Hi there Eternal_Nightma,

    and a warm welcome to these forums.

    You could try this and see if it works for you...
    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
    
    <title>remove meta content</title>
    
    <script type="text/javascript">
    
       var m=document.getElementsByTagName('meta');
    
    for(var c=0;c<m.length;c++) {
    if(m[c].content=='IE=EmulateIE7') {
       m[c].content=''; 
       alert(m[c].content); /* this is for testing purposes and can be removed */
      }
     }
    </script>
    
    </head>
    <body>
    
    <div></div>
    
    </body>
    </html>
    
    Better still, don't use a free site - pay for one.

    coothead

  3. #3
    Join Date
    Jan 2011
    Posts
    3
    Hey coothead, and thanks A LOT for your help! Great idea you had here, removing the content (I think?) :P

    However, I'm trying to get it to work, but I'm not being so lucky today. I've hosted it here and linked to it between head tags, but I don't see any changes yet. I'll try to keep on looking for a solution to that... thanks a bunch for the code.

    If anyone else also has any ideas or comments about this, feel free to share your word please.

    PS: I use a free software since I can't afford a paid one :P

  4. #4
    Join Date
    Jan 2011
    Posts
    3
    You can consider this solved. I took the time to write IE7 hacks and everything is on place now.

    Thanks for your great help, great forum. Keep up the great work!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles