PhoneGap asp.net MVC 4 network error - asp.net-mvc

I publish my asp.net MVC project with visual studio then zip it and upload (with default page index.html )to build.phonegap.com it build project without errors.Then i download .apk but when store to my android mobile devices it gives this error what should i do?
this is my published project folder
folder
this is error : error
this is my index.html code
<html>
<head>
<script language="javascript">
window.location.href = "Home/Index"
</head>
<body>
</body>
</html>

Phonegap expects only html. You can't upload asp.net (or any other technology for that matter) project and expect it to work.
I suggest reading the documentation, starting here: https://build.phonegap.com/docs/preparing-your-app

Related

Web animations ionic 2 iOS

How do you get web animations working in ionic 2 for iOS? I have seen talk about the web animations polyfill, however have not found an easy to follow guide on it's implementation. Any help would be appreciated. Thanks!
Just like you can see in Angular2 docs
Angular animations are built on top of the standard Web Animations API
and run natively on browsers that support it.
For other browsers, a polyfill is required. Grab web-animations.min.js
from GitHub and add it to your page.
So copy the web-animations js code and paste it in a new file located, for instance, in assets/js (new folder).
Then add it to the index.html file, as the first script tag from the body:
<body>
<!-- Ionic's root component and where the app will load -->
<ion-app></ion-app>
<!-- Web Animations polyfill -->
<script src="assets/js/web-animations.js"></script>
<!-- The polyfills js is generated during the build process -->
<script src="build/polyfills.js"></script>
<!-- The bundle js is generated during the build process -->
<script src="build/main.js"></script>
</body>

React Native - Webview files not loaded on device

I am trying to build a react native app for production on iOS device.
In this project I am loading a local html page. Currently I am using the WebView component.
<WebView source={{require('./webapp/index.html')}}/>
And below is webapp/index.html.
<!DOCTYPE html>
<html>
<head>
<title>Foo</title>
</head>
<body>
<h1>Hello World</h1>
<script src="js/script.js" type="text/javascript">
</script>
</body>
</html>
I am building for production by following the steps listed here: https://facebook.github.io/react-native/docs/running-on-device-ios.html#building-your-app-for-production (v0.34)
How can I make sure that index.html is able to load js/script.js?
Most likely we need own server.I was looking for this also and I haven't found any relevant answer to this question too.
I have react-native-webview-bridge hereit seems that now is right inside react-native core but i doubt we can use allowFileAccessFromFileURLs... i will update this answer if i find out something else
I personally use a tool like inliner to insert all the file contents (you might need the dot in your path strings) in my html automatically and then use the html string in my app.
I import my html string in a way that works well for ios and android by implementing this with the current versions of the libraries mentioned.

Phaser game library with javascript and VS 2013 web express

So I'm totally new to the Phaser game library and I'm trying to setup a project using VS 2013 web express in a MVC project. I'm wanting to use javascript (not typescript) and I'm assuming I can just use the IISExpress web service that VS creates when it starts. Most of the tutorials I've seen talk about getting apache setup, but I'd prefer to just use IISExpress when I click run from VS as it's just easier because I don't have to do anything.
So I added phaser to my project. It complained about pixi. So I added pixi to my project, and when I have the following line I get the following error:
var game = new Phaser.Game(500, 600, Phaser.AUTO, 'game_div');
"JavaScript runtime error: Object doesn't support this action"
Is my setup of Phaser OK? Can I not use IISExpress from VS to run phaser?
My Index.cshtml is
#section scripts{
<script src="~/Scripts/pixi/Pixi.js"></script>
<script src="~/Scripts/phaser/src/Phaser.js"></script>
<script src="~/Scripts/main.js"></script>
}
<div id="game_div">
</div>

Link to local files (cdvfile://) on iOS PhoneGap 3.3

To easily update my app, I copy the content of the www folder to the phone and then do a window.location = workingDirectory.toURL() + "/index.html".
EDIT - note that this works until Phonegap 3.4, but not on 3.5 (nothing seems to be happening when I try to change the location). If instead of toURL I use toNativeURL, then it works also on 3.5. Using toNativeURL also fixes the current issue on iOS.
Copying all the files and opening the index works fine on both iOS and Android. The problem on iOS though is that there is absolutely no styling to the page, as if the links to the CSS files weren't working. Everything is working fine on Android.
My links are relative (eg <link href="css/reseter.css" rel="stylesheet">). Links to other pages or to scripts do work.
Here is the simplified main page I open:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="style.css" rel="stylesheet">
<script src="main.js"></script>
</head>
<body>
<div class="red">I should be red but I'm not!</div>
This correctly takes me to the other page.
</body>
</html>
style.css
.red { color: red; }
main.js
alert("HELLO is correctly displayed");
I correctly get the alert (its title is cdvfile://localhost/) and I can also correctly go to page2.html. The only problem is with the styles.
If I open the page in Safari pointing to my computer, the style is correctly displayed.
I tried a few things, to no avail:
Add <base href="cdvfile://localhost/persistent/MyApp/"> in the <head>
Update all my href and src to have the full cdvfile path (eg use <link href="cdvfile://localhost/persistent/MyApp/css/reseter.css" rel="stylesheet">)
I finally got it working in PhoneGap 2.9 by using fileSystem.root.fullPath. On PhoneGap 3.3 it only return /. Is this a bug on PhoneGap 3.3 that when using cdvfile, everything seems to work except the CSS files?
I decided to temporally use a relative path to my app for iOS on PhoneGap 3.3: ../../Documents/MyApp/index.html. I don't know if it's safe to use or not.
EDIT In Phonegap 3.5 (I haven't tested in 3.3), using work window.location = workingDirectory.toNativeURL() + "/index.html"; (ie using toNativeURL instead of toURL) works.
Check the following link (the plugin was changed):
http://cordova.apache.org/news/2014/02/10/plugins-release.html
It looks like you are running into CB-6532. I just put in a pull request for a fix -- you can temporarily use my fork until it is accepted:
https://github.com/loufranco/cordova-plugin-file
To use it, do
cordova plugin remove org.apache.cordova.file
cordova plugin add https://github.com/loufranco/cordova-plugin-file.git
Remember to reverse it if the pull request is accepted.

jquery not working in asp.net mvc after publishing to server

I've built an mvc application which contains some jquery code. When I run the app from my ide, everything works perfectly. When I publish to the server and open the page, the jquery does not work. I get object expected errors.
Could this be due to my file mappings? here is a sample of my mapping in the app -
<script type="text/javascript" href="../../Scripts/jquery-1.3.2.js"></script>
I published the app to iis7 successfully, but the jquery is broken. I did publish to an application within an existing web site.
Any thoughts?
You may be experiencing problems with your relative path.
You can try this, which is a path from the application root:
<script type="text/javascript" href="/Scripts/jquery-1.3.2.js"></script>
Or this C# solution:
<script src="<%= Url.Content("~/Scripts/jquery-1.3.2.js") %>" type="text/javascript"></script>

Resources