如何使用javascript正确地在头部功能中制作元标记 [英] How to make meta tag in head function correctly using javascript

查看:61
本文介绍了如何使用javascript正确地在头部功能中制作元标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我想在头部插入元标记,但它没有考虑到这是我试过的内容



我尝试了什么:



i已尝试过这条指令,但它没有考虑到

$('head')。append('< meta http-equiv =X-UA-Compatiblecontent =IE = 8>');



我将它直接添加到头部工作

解决方案

('head')。append('< meta http- equiv =X-UA-Compatiblecontent =IE = 8>');



我将它直接添加到工作中

当您的Javascript执行时,更改IE兼容模式为时已晚。



您需要向文件添加静态元标记,或从服务器发送标头。如果您使用元标记,则需要在除标题标记之外的任何其他标记之前。


hello,

I want to insert meta tag in head but it dosen't take in consideration this is what i have tried

What I have tried:

i have tried this instruction but it dosen't take in consideration
$('head').append('<meta http-equiv="X-UA-Compatible" content="IE=8" >');

and whene i add it directly in head it work

解决方案

('head').append('<meta http-equiv="X-UA-Compatible" content="IE=8" >');

and whene i add it directly in head it work


By the time your Javascript executes, it's too late to change the IE compatibility mode.

You need to add a static meta tag to the file, or send the header from the server. If you use the meta tag, it needs to come before anything else except the title tag.


这篇关于如何使用javascript正确地在头部功能中制作元标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆