如何在phonegap/jquerymobile应用程序内使用外部图像 [英] How to use external image inside phonegap/jquerymobile app

查看:127
本文介绍了如何在phonegap/jquerymobile应用程序内使用外部图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Android开发一个phonegap/jquery-mobile测试应用程序(我是该技术的新手),我想在我的应用程序中显示存储在互联网站点上的图像.在avd中启动应用时,将index.html此元素放入

I'm developing a phonegap/jquery-mobile test application (I'm new in this technologies) for android and I want show inside my app an image stored on internet site. During app startup in avd I receive this notification when put in my index.html this element:

<img src="http://www.comolakeboats.it/images/stories/boats/gommone_12_150x100.jpg" width="120px;" />

应用程序错误-与服务器的连接不成功(file:///android_asset/www/index.html)

Application Error - the connection to the server was unsuccessfull (file:///android_asset/www/index.html)

在log.cat上,我可以看到此错误:

On log.cat I can see this error:

E/DroidGap(337):DroidGap:超时错误! -调用webViewClient

E/DroidGap(337): DroidGap: TIMEOUT ERROR! - calling webViewClient

我已经通过外部链接检查了浏览器和应用程序内部的连接,在两种情况下我都可以访问互联网站点.

I already checked connection both from browser and inside my application with an external link and in both case I can reach internet site.

我想念的是什么?是否存在适用于Iphone的解决方案(可能相同)?

What I'm missing? Exists a solution (maybe the same) suitable for Iphone,too?

这是我的代码:

<body>

    <div data-role="page" id="home_it"> 
        <div data-role="header" data-theme="a" id="it">
            <h1>TEST</h1> 
            <div data-role="navbar" data-iconpos="right" data-theme="a">
                <ul>
                    <li><a href="tel://+3933333333">Tel:+3933333333</a></li> 
                    <li><a href="mailto:info@test.it?subject=Info">Email</a></li>   
                </ul>
            </div> 
            <div class="ui-body ui-body-c"><!--  ui-body-b">-->  
                <p>Some text</p>
                <button id="my_list_button">Mostra</button>
            </div>
        </div> 
        <div data-role="content"  class="ui-body">
            <ul data-role="listview" id="my_list">
                <li data-role="list-divider">My list</li>
                <li>
                    <a href="http://www.comolakeboats.it" rel="external">
                        <img src="http://www.comolakeboats.it/images/stories/boats/gommone_12_150x100.jpg" width="120px;" />
                        <h3>title foo foo</h3>
                        <p style="color:red">foo foo foo foo</p>
                    </a>
                </li>
            </ul>
        </div>
                    <div data-role="footer">
            <div data-role="navbar" data-iconpos="right" data-theme="a">
                <ul>
                    <li><a href="#home" data-icon="home">&#160;</a></li>    
                    <li><a id="exit-app" data-icon="back">&#160;</a></li>    
                </ul>
            </div>  
        </div>
    </div> 


</body>

提前谢谢

推荐答案

您是否实际上已更新了phonegap的白名单?告诉应用允许访问哪些URL.您还可以在其中添加*,如此处所述

Did you actually update the phonegap's whitelist? that tells the app which URLs it's allowed to access. You can also add a * to it, as described here

希望这会有所帮助

这篇关于如何在phonegap/jquerymobile应用程序内使用外部图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆