【发布时间】:2014-02-27 14:21:16
【问题描述】:
所以我知道如何在 Titanium Webview 中访问外部和内部 URL。但我不知道如何从外部 url 重定向到内部 url。
我在根文件夹中有一个名为“index.html”的文件,因此对于 webview 来说应该可以访问它:
Ti.UI.createWebView({
url: 'index.html'
});
外部网址非常简单
Ti.UI.createWebView({
url: 'http://www.google.com'
});
但是,当在外部 url 上时,我如何重定向到这个本地文件?这些都不起作用:
<a href="file://index.html">LOCAL?</a>
<a href="file:///index.html">LOCAL?</a>
或 javascript 变体
window.location = 'file:///index.html';
关于如何做到这一点的任何线索?
【问题讨论】:
-
只是想知道如果 webView.evalJS('someFunctionToPrintout(window.location);'); 你会得到什么值当 webView 打开本地文件时 index.html 会给你本地文件的正确路径吗?
-
我正在获取文件的完整路径,
file://Users/username/[..]/index.html
标签: ios redirect webview titanium appcelerator