[英]External javascript working in simulator but not in ios device
I am using Titanium sdk 3.02 and iOS SDK 6.1. 我正在使用Titanium SDK 3.02和iOS SDK 6.1。 Currently facing an issue with the external javascript.
目前正面临外部javascript问题。
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="test.full.js"></script>
<script type="text/javascript">
testing_function();
</script>
</head>
</body>
</html>
This function is working fine in simulator but nothing happens in device.Please suggest some solution to work it with device as well. 该功能在模拟器中可以正常使用,但在设备中什么也没有发生。请提出一些解决方案,以使其与设备一起使用。
Make sure that the .JS file is located in the same directory as your HTML file. 确保.JS文件与HTML文件位于同一目录中。 Also try to browse directly to the .JS (from the device) file to make sure you can reach it.
另外,尝试直接从设备浏览到.JS文件,以确保可以访问它。
How did you open your base HTML file? 您是如何打开基本HTML文件的? Because the UIWebView
因为UIWebView
– loadHTMLString:baseURL:
function must be well paramterised (the source must be available relative to the baseURL). 函数必须参数化(源必须相对于baseURL可用)。 http://developer.apple.com/library/ios/documentation/uikit/reference/UIWebView_Class/Reference/Reference.html#//apple_ref/occ/instm/UIWebView/loadHTMLString:baseURL :
http://developer.apple.com/library/ios/documentation/uikit/reference/UIWebView_Class/Reference/Reference.html#//apple_ref/occ/instm/UIWebView/loadHTMLString:baseURL :
Your .js is available using the same path, as yout HTML file? 您的.js使用与HTML文件相同的路径可用吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.