带有外部 Javascript 的 IEMobile 7.11?
我正在尝试使用运行 IEMobile 7.11 的 Windows Mobile 6.1 设备,并且我正在尝试加载外部 javascript,如下所示:
<html>
<head>
<script type="text/javascript" src="js/alert.js"></script>
</head>
<body><?php echo('<pre>'); print_r($_SERVER); echo('</pre>'); ?></body>
</html>
alert.js 看起来像这样:
alert('this is included javascript');
目前没有出现,但是如果我将 javascript 拉入实际的 HTML页面工作正常。这是 iemobile 的已知问题吗?我似乎在谷歌上找不到太多关于它的信息。或者我做错了什么?
先感谢您。
I'm trying to work with a windows mobile 6.1 device running IEMobile 7.11 and I'm trying to load external javascript as such:
<html>
<head>
<script type="text/javascript" src="js/alert.js"></script>
</head>
<body><?php echo('<pre>'); print_r($_SERVER); echo('</pre>'); ?></body>
</html>
alert.js looks like this:
alert('this is included javascript');
Currently this is not appearing, however If i pull the javascript into the actual HTML page it works fine.. Is this a known issue with iemobile? I can't seem to find much on google around it.. or am I doing something wrong?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我怀疑对原始海报的有用回应已经太晚了,但我最近遇到了同样的问题。最终我发现 IEMobile 没有执行 JavaScript 文件,因为服务器正在发送带有“application/javascript”内容类型的文件。
虽然这是 JavaScript 文件的正确 mime 类型,并且它适用于 IEMobile 的早期版本(可能完全忽略它),但如果 IEMoblie7.11 显然无法识别它,则某些版本可以使用它。
更改您的网络服务器以将 JavaScript 文件发送为“application/x-javascript”似乎可以解决该问题。作为一个较旧的标准,我猜“text/javascript”也可以工作,尽管我自己没有尝试过。
Too late to be a useful response to the original poster I suspect, but I recently encountered the same problem. Eventually I figured out that IEMobile wasn't executing the JavaScript file because the server was sending the file with an 'application/javascript' content-type.
While that's the correct mime-type for JavaScript files, and it works on earlier versions of IEMobile (which presumably ignore it entirely) some versions if IEMoblie7.11 apparently don't recognise it.
Changing your web server to send JavaScript files as 'application/x-javascript' seems to fix the problem. Being an older standard, I'd guess 'text/javascript' would also work, though I didn't try it myself.
我很抱歉。
好吧,IEMobile<8 有一百万个问题,但它能做的一件事就是包含来自外部文件的 JavaScript。
文件中真的只有这一行吗?您是否检查过其中没有无关的内容,例如某个愚蠢的 Windows 文本编辑器保存的 UTF-8 编码的人造 BOM?其他浏览器加载脚本是否正常?
您是否启用了脚本错误?自 Netscape 4 以来每个浏览器都支持的许多标准 DOM 方法在 IEMobile<8 上仍然会失败,如果它默默地吞下错误,您将没有机会调试任何关于这个肮脏的东西。
I'm so sorry for you.
Well, there are a million things wrong with IEMobile<8, but one thing it just about can do is include JavaScript from an external file.
Is that one line really the only thing in the file? Have you checked there's no extraneous crud in it, like a UTF-8-encoded faux-BOM saved by some idiotic Windows text editor? Do other browsers load the script OK?
Have you enabled script errors? Many standard DOM methods that every browser since Netscape 4 has supported still fail on IEMobile<8 and you will have no chance of debugging anything on the foul thing if it silently swallows errors.