Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/412.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.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
Javascript blackberry webworks:将本地页面加载到iframe时崩溃_Javascript_Blackberry_Iframe_Blackberry Webworks - Fatal编程技术网

Javascript blackberry webworks:将本地页面加载到iframe时崩溃

Javascript blackberry webworks:将本地页面加载到iframe时崩溃,javascript,blackberry,iframe,blackberry-webworks,Javascript,Blackberry,Iframe,Blackberry Webworks,在blackberry webworks应用程序中,我尝试将页面加载到与应用程序打包的iframe中,但应用程序不断崩溃(它打开启动屏幕,不加载任何内容) 我要加载的页面位于(相对于我的应用程序的index.html): 我试着用以下路径加载它: pages/help_en/home.html ./pages/help_en/home.html local:///pages/help_en/home.html 但所有这些都导致了那场车祸。 当我从外部服务器加载它时,它工作正常。。。 也许我还应

在blackberry webworks应用程序中,我尝试将页面加载到与应用程序打包的iframe中,但应用程序不断崩溃(它打开启动屏幕,不加载任何内容) 我要加载的页面位于(相对于我的应用程序的index.html):

我试着用以下路径加载它:

pages/help_en/home.html
./pages/help_en/home.html
local:///pages/help_en/home.html
但所有这些都导致了那场车祸。 当我从外部服务器加载它时,它工作正常。。。 也许我还应该提到,这只发生在智能手机上,在PlayBook(平板电脑)上,它工作正常


任何帮助都将不胜感激,提前谢谢

下面的代码示例可以将本地页面(应用程序内)加载到iframe中。它还使用与您相同的文件夹结构。它已经过测试并打包到WebWorks应用程序中,并加载到设备上,页面在iframe中正确加载。除了主页之外,请确保还包含config.xml文件

<!DOCTYPE html>
<html>
<head>
    <title>Iframe</title>
    <meta id="viewport" name="viewport" 
        content="initial-scale=1.0,width=device-width,user-scalable=no,target-densitydpi=device-dpi"/>
    <script type="text/javascript">
    function changeSrc(){
        document.getElementById('theFrame').src = "pages/help_en/home.html";
    }
    </script>
</head>
<body>
    Iframe is below<br/>
    <button onclick="changeSrc()">click me</button><br/>
    <iframe id="theFrame" src=""></iframe>
</body>
</html>

内联框架
函数changeSrc(){
document.getElementById('theFrame').src=“pages/help\u en/home.html”;
}
Iframe低于
单击我

我就是这样尝试的。。。我一点击按钮,应用程序就崩溃了。我绕过了这个问题,在没有iframe的情况下直接将内容加载到页面中。。。
<!DOCTYPE html>
<html>
<head>
    <title>Iframe</title>
    <meta id="viewport" name="viewport" 
        content="initial-scale=1.0,width=device-width,user-scalable=no,target-densitydpi=device-dpi"/>
    <script type="text/javascript">
    function changeSrc(){
        document.getElementById('theFrame').src = "pages/help_en/home.html";
    }
    </script>
</head>
<body>
    Iframe is below<br/>
    <button onclick="changeSrc()">click me</button><br/>
    <iframe id="theFrame" src=""></iframe>
</body>
</html>