从文档的主体注入元标记? [英] Inject a meta tag from a document's body?

查看:105
本文介绍了从文档的主体注入元标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要添加元标记(特别是,< meta name =apple-itunes-appcontent =app-id = xxxxx> )到某个页面,但是我们的模板的设置方式,我不可能直接编辑HEAD标签的代码(对于公司而不是技术原因)。



因此,在BODY标签中使用JQuery来添加这个元标签有没有办法? 可能你可以试试
$ b jQuery: $('head')。append('< meta name =apple-itunes-appcontent =app-id = xxxxx>');

Javascript:

  document.getElementsByTagName('head')[0] .appendChild('< meta name =apple-itunes-appcontent =app-id = xxxxx> ); 


I need to add a meta tag (specfically, <meta name="apple-itunes-app" content="app-id=xxxxx">) to a certain page, but the way our templates are set up, it's not possible for me to edit the code for the HEAD tag directly (for corporate, not technical, reasons).

Therefore, is there a way using JQuery within the BODY tag to add this meta tag?

解决方案

Maybe you can try this:

jQuery:

$('head').append('<meta name="apple-itunes-app" content="app-id=xxxxx">');

Javascript:

document.getElementsByTagName('head')[0].appendChild('<meta name="apple-itunes-app" content="app-id=xxxxx">');

这篇关于从文档的主体注入元标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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