简体   繁体   English

外部JavaScript在模拟器中工作,但不在ios设备中工作

[英]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.

相关问题 Phonegap Javascript .html()在iOS模拟器中不起作用? - Phonegap Javascript .html() not working in iOS simulator? Browserify JavaScript库在iOS模拟器上运行良好,但在真实设备上 - Browserify javascript library work well on iOS simulator but real device Javascript日期/时间无法在使用Chrome的iOS设备上运行 - Javascript Date/Time not Working on iOS Device with Chrome iOS设备(而不是iOS Simulator)上的文件路径损坏 - Broken file path on iOS device, not on iOS Simulator 如何在 JavaScript 中检测 iOS 模拟器 - How to detect iOS simulator in JavaScript 设备和模拟器上的流星 ios 空白屏幕 - Meteor ios blank screen on device and simulator 用于Apache Cordova的JavaScript代码在模拟器Ripple上运行,但不在Live Windows Phone设备中运行(L 535) - javascript code for apache Cordova working on simulator Ripple but not in Live windows phone Device (L 535) iOS Safari视频/相机无法在移动设备上运行 - Javascript和Html - iOS Safari video/camera not working on mobile device - Javascript and Html 在模拟器上的IOS上测试本地html / javascript文件 - Test local html/javascript files on IOS on Simulator Cordova iOS模拟器tel和mailto无法正常工作 - Cordova iOS Simulator tel and mailto not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM