English 中文(简体)
使用 yepnope.js 装入字符集
原标题:Loading charset using yepnope.js

是否有办法不使用 yepnoope.injectJs 方法而使用载荷方法将 字符设置: "utf-8" 输入到yopope 上载方法上,而不使用 yepnoope.injectJs 方法

yepnope({
         load: newResourcesToBeLoaded,
         complete: function() {
                   addNewlyLoadedResources(newResourcesToBeLoaded);
                   completeCallback();
         }
});
问题回答

不容易, 但你可以使用过滤器来做 :

yepnope.addFilter(function (resourceObj) {
  if (resourceObj.url.slice(-3) == ".js") {
    resourceObj.attrs = resourceObj.attrs || {};
    resourceObj.attrs["charset"] = "UTF-8";
  }
  return resourceObj;
});

如果您重现我曾经遇到过的任何问题, 虽然这样会有所帮助, 没有字符集属性的脚本应该取回文档的字符集( 从 Content- Type header 或 标签) 。 在将 UTF-8 编码的文件装入定义的 BOM (字节顺序标记), 特别是 Firefox 中, 有些浏览器存在问题 。

而且,yopnoope.js试图在非国际兽疫局/奥佩拉浏览器的脚本上加载标签,这显然是我所有问题的根源,最终让我改换成LABjs。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签