admin管理员组文章数量:1289346
I am trying to load an external library to the admin section of my website. On the front end it is pretty easy to load.
<head>
<script src="externalLibrary"></script>
<script src="externalLibrary"></script>
<script src="externalLibrary"></script>
<script src="externalLibrary"></script>
<script src="externalLibrary"></script>
<script src="externalLibrary"></script>
</head>
On the back-end we don't have access to the head section so the library links have to be loaded from an external file.
function myCustomScript($hook) {
wp_enqueue_script( 'admin-js', plugins_url( 'admin-columns/js/admin.js' , dirname(__FILE__) ) );
}
add_action('admin_enqueue_scripts', 'myCustomScript');
The external file loads perfectly, I just need help making the urls available in the external file.
This is what I have tried in the js file
var sc = document.createElement("script");
sc.setAttribute("src", ".js");
sc.setAttribute("type", "text/javascript");
document.head.appendChild(sc);
document.getElementsByTagName("head")[0].appendChild(sc);
本文标签: javascriptHow do I load urls from an external js file to my admin head
版权声明:本文标题:javascript - How do I load urls from an external .js file to my admin head? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741429818a2378288.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论