How to fix the Runtime Error In server using jqueryMobile in MVC3? - jquery-mobile

I had develop a small jquery-mobile application in telerik MVC3. It is working in local machine and i uplod into my server and tested it works for desktop devices but when I test in Mobile (Iphone) it shows Error Like runtime Error
<!--web.config Cofiguration File-->
<configuration>
<system.Web>
<customErrors mode="Off"/>
</system.Web>
</configuration>
I can't understand why it showing only in mobile device please help me. How can I solve this error.

I think you can't see the error page due to the fact that JQueryMobile only shows a small popup with the message "Error loading page".
You can disable Ajax and this way see all html pages as a regular web app would.
Just add this script between Jquery and Jquery mobile script references
<script language="javascript" type="text/javascript">
$(document).bind("mobileinit", function () {
$.mobile.ajaxEnabled = false;
});
</script>

Related

Using input type="file" with ASP.Net and iPad and IIS's Windows Integrated Authentication

I'm trying to do a really basic, no-frills file upload on a boring old HTML page using input type="file" that posts to an .aspx page, both hosted on IIS (both IIS7 and IIS8) with Windows Integrated Authentication enabled (not anonymous). It works just fine on Chrome for desktop, but if I use either Chrome or Safari on iPad, I can sign in (to get past Windows Auth) and see the form, but if I pick a file and click Send, it just sits and spins. If I don't pick a file, it works fine. If I switch from Windows Auth to Anonymous Auth, it works fine, even on the iPad. The file I'm picking is just from the iPad's photo library (originally taken with the built-in camera), and when testing Chrome for desktop, I'm testing with the exact same file (which is tiny, 1.4M).
Here's the default.html:
<!doctype html>
<html>
<head>
<title>Upload Test</title>
</head>
<body>
<form method="post" enctype="multipart/form-data" action="upload.aspx">
<input type="file" name="foo" />
<input type="submit" value="Send" />
</form>
</body>
</html>
upload.aspx:
<%# Page Language="C#" CodeBehind="upload.aspx.cs" Inherits="UploadTest.Upload" %>
upload.aspx.cs:
using System;
using System.Web.UI;
namespace UploadTest
{
public partial class Upload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Response.ContentType = "text/plain";
this.Response.Write("Got here");
this.Response.End();
}
}
}
Notice I don't even try to access this.Request.Files in the above, although if I do, for instance:
var file = this.Request.Files["foo"];
this.Response.Write("Filename: " + (file == null ? "(no file)" : file.FileName));
...I do see the filename in the cases where it works.
I don't have a Web.config: I just copied bin, default.html, and upload.aspx into a test directory under C:\inetpub\wwwroot and then used IIS Manager to convert that to an application with default settings, and switch from Anonymous Auth to Windows Auth. (But this is an MCVE of a much more complex project that did have a Web.config, I've just been stripping things back to the bone to find the problem.)
To recap:
Works just fine in Chrome on desktop
Works just fine on iPad if I don't pick a file
Works just fine on iPad if I switch to Anonymous Auth instead of Windows Auth and do pick a file
Spins forever on iPad if I'm using Windows Auth and pick a file using either Chrome or Safari for iPad
I'm not a big ASP.net guy. What am I doing wrong? Some config switch I need to flip?
I switched to using the Kerberos Security Authentication Protocol rather than NTLM protocol and uploads started working for me.
As far as I can tell, this is a bug in iOS (!), and it's fixed in iOS 11.0. The exact same configuration that doesn't work with v10.3 works with v11.
Unfortunately, iOS 11.0 will only be made available for 5th gen onward, so we've had to work around this by reading the file via the File API and sending it in batches to the server as non-file data. Ugly workaround, but it was the only thing that worked.

mobile joomla and jquery ui conflict

We have a mobile version of our Joomla site using mobile Joomla and everything was working fine until we introduced the jquery UI for the autocompletion functionality into the equation. We now get the following error "Uncaught TypeError: Object 0 has no method 'match'" which after googling seems to indicate it being a conflict between Mobile Joomla and jQuery UI.
We can prove this if we remove the UI it runs fine again.
Any help would really be appreciated.
Thanks
Richard
Use $.noConflict(); and inside (document).ready(function() put $ inside (function()
Example:
$.noConflict();
jQuery(document).ready(function($){
$("button").click(function(){
$("p").text("jQuery is still working!");
});
});

Jquery AJAX success not getting triggered with Coded UI test project

I am trying to run a Coded-UI test project on a asp.net MVC4 application.
The application contains various ajax calls involved.
When i test it manually,it works fine but when i test it by using coded-ui test project,
it breaks because in the ajax calls,the callback function does not get called.
Can anybody tell me what am i missing here.?
Thanks in advance.
What's going wrong
Microsoft's Coded UI browser injects javascript to shim the XMLHttpRequest object for tracking. Any ajax calls in the page will use this shim instead of the real XMLHttpRequest. The shim assumes that your completion callback is attached to the XMLHttpRequest's onreadystatechange property, but jQuery 2.0 uses the new onload and onerror events, so the callback is never called by the shim.
Workaround
The work-around is to add the following to the App.config file for your test project:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="WebWaitForReadyLevel" value="3"/>
</appSettings>
</configuration>
Setting WebWaitForReadyLevel to 3 stops the Coded UI WebBrowser from injecting the javascript to track ajax calls and timers. jQuery will get a real XMLHttpRequest, and your ajax callbacks will work again.

MVC links not working in jquery mobile app environment

I am working on converting my existing MVC website to be Mobile friendly. I am having issues when clicked on links, it is showing empty page. If I remove following links in _Layout.Mobile.cshtml
#System.Web.Optimization.Scripts.Render("~/bundles/jquery")
#System.Web.Optimization.Scripts.Render("~/bundles/jquerymobile")
Then it works fine but I loose all the styling and the text on webpage displays very tiny.
I am using Opera Mobile emulator for testing.
The links are local and are like "localhost:62234/Articles/10".
Just to give some more background I am converting my Framework 4.5 MVC website to be Mobile friendly. I have added all the libraries needed and main page works fine. I am having issues when links are pressed on main page. Initially clicking on links was doing nothing, then I did some research and discovered that I have to add tag rel="external" to the links to make them work. Now links work but displays empty page. Any help is greatly appreciated.
Here is solution I found which solved my problem finally.
Here is how my code looks now..in _Layout.Mobile.cshtml
#System.Web.Optimization.Scripts.Render("~/bundles/jquery")
#System.Web.Optimization.Scripts.Render("~/bundles/jquerymobile")
<script type=”text/javascript” src=”#Url.Content("~/Scripts/jquery-2.0.2.min.js")"></script>
<script type=”text/javascript”>
$(document).bind("mobileinit", function () {
$.mobile.ajaxEnabled = false;
});
</script>
<script type=”text/javascript” src=”#Url.Content("~/Scripts/jquery.mobile-1.3.1.min.js")"></script>
I found some more information with this problem Here.
Hope this helps others

What features of Zepto do not work on ie9?

On the zepto project website i see no version of IE as being supported, not even 9.
I am considering using zepto in a webapp (not mobile) but i want to support IE 9+
Is that possible? What features / methods of zepto do not work on IE9?
Out of curiosity I just loaded up the following page and tested in current versions of Chrome, Firefox, Safari and IE9. In all but IE9 I was greeted with the alert() message. IE9 gave me no alert and contained two errors in the console. Here's the code I used, with the Zepto library in the same folder.
<!doctype html>
<h1>Zepto Browser Support Test</h1>
<script src="zepto.min.js"></script>
<script>
$(function () {
alert('Zepto Ready Successful!');
});
</script>
So, unfortunately for your web app, if you are trying to support IE9, it doesn't look like Zepto is going to work for you.
Although, what the good folks at Zepto encourage if you are trying to reach IE users is to fallback to jQuery. They even give you the code to do so.
If you need to support Internet Explorer, you can fall back on jQuery. Note that conditional comments are no longer supported starting on IE 10, so we recommend the following document.write approach:
<script>
document.write('<script src=' +
('__proto__' in {} ? 'zepto' : 'jquery') +
'.js><\/script>')
</script>
I found this in the Zepto docs near the top of the page.
Hope that helps and good luck!

Resources