问题描述
我是在 Android 上制作的。
改为
// Set by <content src="index.html" /> in config.xml
loadUrl("file:///android_asset/www/Any_Page.html);
但我无法在 Xcode 中为 iOS 应用程序创建相同的链接。 在 Appdelegate.m 中,我可以更改起始页**
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
self.viewController = [[MainViewController alloc] init];
self.viewController.startPage = @«My_page.html; // relative path works
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
但是我需要获取 url 路径才能在 Cordova 中选择我的起始页。 还有第二种方法 - 在 index.html 中从 JavaScript 更改起始页
<script>
window.location.href = “MyPage.html”;
</script>
但我需要我的应用程序打开的 url 路径。 我网站上的 URL 路径与应用中的相同。
/content/page1.html
/content/page2.html
等等... 我需要从链接打开我的应用时 - 在应用中显示相同的内容。
解决方法
Cordova 中有一个未维护的通用链接插件。
不久前我创建了一个分支并进行了一些修复:https://github.com/GEDYSIntraWare/cordova-universal-links-plugin