Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 无法读取属性';主机';未定义的_Android_Iphone_Uiwebview_Cordova_Android Webview - Fatal编程技术网

Android 无法读取属性';主机';未定义的

Android 无法读取属性';主机';未定义的,android,iphone,uiwebview,cordova,android-webview,Android,Iphone,Uiwebview,Cordova,Android Webview,我在android/iphone中创建webview并用html填充时遇到了一个问题 唯一有效的方法是: 将嵌入代码从外部URL加载到同一URL 有什么问题吗 thnks 伊丽莎所以最后我的解决方案非常简单 我有以下源代码: if ( !this.host ) { this.host = defaultUri.host; // port ? if ( !this.port ) { this.port = defaultUri.port;

我在android/iphone中创建webview并用html填充时遇到了一个问题

唯一有效的方法是: 将嵌入代码从外部URL加载到同一URL

有什么问题吗

thnks


伊丽莎

所以最后我的解决方案非常简单

我有以下源代码:

  if ( !this.host ) {
    this.host = defaultUri.host;
    // port ?
    if ( !this.port ) {
        this.port = defaultUri.port;
        }
    }

只需添加:尝试和捕捉,一切都会工作

这个问题不太清楚。webview不是从外部URL或资产文件夹加载的吗?您面临的问题是什么?请提供更多详细信息感谢您的回答我发现了问题:我有以下代码行:this.host=defaultUri.host;this.host是空字符串,因此应用程序崩溃,但当我给出一个url(例如this.host=www.example.com)时,一切似乎都正常。