vs2017 js cordova + dotnet core 开发app


1.记得在index.html加入 

  <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *;connect-src *;"> 

   <script type="text/javascript" src="scripts/jquery-2.1.4.min.js"></script>

2.控件click事件绑定

  

document.querySelector('#button1').addEventListener('click', function () {

$.get("http://192.168.1.102:5000/api/values", function (result) {
alert(result);
});

});

 

3.dotnet core项目中program.cs设置开启运行外部访问

 添加.UseUrls("http://*:5000")

如下

public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseUrls("http://*:5000")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();

host.Run();
}
}

 

4.移动设备webview浏览网页需要在config.xml中添加 <allow-navigation href="*" />

<p>
<a href="http://www.baidu.com">jump web</a>
</p>

 

http://stackoverflow.com/questions/36036475/cordova-6-0-ios-load-external-url-in-the-webview


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM