jQuery Mobile changePage() not working in Windows Phone - windows-phone-7

I am developing an application using Phonegap for Windows Phone 8.
I've used jQuery Mobile for interface design.
the $.mobile.changePage() is not working. The page is not being changed.
Is there any other way to change the page? Is there any other framework to design the interface for mobile?
$("#btnSearch").bind('click', function() {
showSpinner();
$.mobile.changePage("#pageSearch");
});

I think this problem is the same as in WP7 described here.
CHECK FOR PATH PROBLEM:
if($.mobile.path.getLocation("x-wmapp1:/app/www/index.html") != "x-wmapp1:/app/www/index.html")
{
console.log('there is path problem');
}
else
{
console.log('everything is OK with paths');
}
SOLUTION:
As described in github, problem is path on WP7 differs from other platforms. Basically on WP7 getLocation prints relative paths with double slashes, which causes this issue at first place. To fix, open jquery.mobile-1.3.1.js and refactor following:
- var uri = url ? this.parseUrl( url ) : location,
- hash = this.parseUrl( url || location.href ).hash;
+ var uri = this.parseUrl( url || location.href ),
+ hash = uri.hash;
and:
- return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash;
+ return uri.protocol + uri.doubleSlash + uri.host + uri.pathname + uri.search + hash;
After making this changes, check should display "everything is OK".
PS This is tested on WP7 and totally fixed my issue with $.mobile.changePage().
PS2 This issue is fixed at github version of jQuery, although I've just checked latest stable version(1.3.2) and unfortunately it is NOT fixed there.
Regards,
Hristo Todorov

I did have the paths problem mentioned in the answer above, but this didn't solve my problem. I discovered after a lot of trial and error that it was the protocol on the begining of the URL that was causing the problem.
A change page for "mypage.html" will send an Ajax request for
x-wmapp0://www/mypage.html
It needs to be just
www/mypage.html
I made a modifcation to the jQuery Mobile source to manipulate the string to cut off the protocol and now it works perfectly.
To apply the fix, in the un-minified jQuery Mobile js file, search for "$.ajax" and add the following just before it:
var parts = fileUrl.split("www/");
fileUrl = "www/" + parts[parts.length-1];
This actually removes "x-wmapp0://www/" and puts the "www/" back on again. Removing just "x-wmapp0://" does not always work because of the way jQuery Mobile works with urls, resulting in "www/www/..." in some cases.
This is confirmed to work with Cordova 3.1 and 3.3 with jQuery Mobile 1.3.2

I think the method was renamed to "pagechange"
http://jquerymobile.com/blog/2011/09/08/jquery-mobile-beta-3-released/#upgrade

Related

SignalR 2.0.1, done trigger Ie8

I'm using SignalR (2.0.0 then 2.0.1) to make some real-time web application. Every 5 seconds it receives some data... Also process user events. Anything works, but i have problems with IE8 (same with any version if IE + compatibility Mode).
var worker = $.connection.mainHub;
...
worker.client.test= function () { ... };
var connection = ((navigator.userAgent.match(/iPad/i) != null) ?
$.connection.hub.start({ transport: ['webSockets', 'longPolling'] }) :
$.connection.hub.start())
.done(function () { console.log($.connection.hub.id);});
1) The first one: after ~1-2minutes of working - everything became slower(user events like pressing buttons, simple css hover action, etc.), IE seems to be dieing.
I thought the reason is memory leak.. it's a large amount of JavaScript (I'm using knockoutjs to build my html). But now i'm not sure
2) I need to have some clarity, how should I reload the page.
I'm using "location.href = location.href;" and everything fine, but in IE it seems to cause an error.
Not always, but often there is an error "$.connection.hub.id is undefined". I check $.connection.hub.transport, it's undefined too. Have no idea what i'm doing wrong...
it seems there was redirecting to other page at the moment of 'done' occured. jquery.signalR stayed on the other page.. I guess there is some specific of brouser cash

Socket.io and Internet explorer

I'm having trouble with socket.io not working on internet explorer 8 and 9.
Give this error:
'this.websocket' is null or not an object
socket.io.min.js line 2
I've set the WEB_SOCKET_SWF_LOCATION this way. It is part of Jquery $(document).ready
var WEB_SOCKET_SWF_LOCATION = 'http://photosandhomes.ca/static/WebSocketMain.swf';
var page_loadSock = io.connect('/page_load');
Thank you.
PS. Here's a live example
http://photosandhomes.ca/33harbour/
The problem was that I had "var WEB_SOCKET_SWF_LOCATION" in the code.
If you're having the same problem use "WEB_SOCKET_SWF_LOCATION" without the var in the global namespace.
I personally placed WEB_SOCKET_SWF_LOCATION into the socket.io.js file.

Switch update panel to full postback when specific firefox ver detected

I'm facing a problem with firefox versions < 3.6 and I'd like to get a fix for that.
My issue is update_panel related, but I couldn't find any information on similar issues and can't really name the problem as it occurs rarely ( and not on localhost) :
"the updatepanels freezes and doesn't react"
My problem is that I cannot identify the problem and thus would like to switch the updatepanel to work with full postbacks (standard is asnyc) when I detect firefox + ver < 3.6
My question is basically, how to "disable"/set the updatepanel to do full postbacks only in this case ? Both codebehind and serverside solutions are acccepted
System.Web.HttpBrowserCapabilities browser = Request.Browser;
double versionb = 3.5;
if (browser.Browser == "Firefox" && Convert.ToDouble(browser.Version) <= versionb)
{
}
Solved this by removing and adding new PostbackTriggers at Page_init.

image using .ashx

i am using .ashx to retrive image and i place the the image inside the ajax update panel it retrive the image when a new image is added to the form but when we change the image it is not updating the image it dont even call the .ashx file but when i refresh the browser it works properly
Sounds like a caching issue. Try adding some of the lines found here to your ashx file and it should hopefully force the browser to rerequest the image. (I know that the link is for ASP rather than ASP.NET, but things like Response.Expires = -1 should work)
Alternatively, can you change the path to the image in the updatepanel? If you just add a random parameter on to the end of it the browser will treat it as a fresh request (we use the current date/time as a parameter when we're doing this. The parameter is ignored by ASP.NET unless you explicitly reference it)
Do something like this:
var sPath = "../../handlers/ProcessSignature.ashx?type=View&UserID=" + userID + "&d=" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
That puts a 4 character alpha numeric string at the end of your query string. It's not needed, but it will force browsers to pick up the latest version of that image because the URL is different.
I tried the above and some browsers ignore the headers. I threw all of those in and Chrome/FireFox 3 didn't try to update.
IE7 worked sometimes
IE6 just twiddled it's thumbs and asked why it was still in existence.
Changing the path above will fix it in all browsers.

Ajax file upload not working in chrome browser

I am using AjaxUpload for file upload but with the recent update in Chrome, it seems to be no longer working in chrome and many other browsers. So I started to figure it out. I have to spend around 2 to 3 hours trying various possible ways but it was not working.
The Issue was, When we select image or file then it was calling the OnComplete Event without calling server-side action due to which it was returning a null empty value. And after completed with OnComplete event then server-side action got called with no return back to OnComplete Event.
When “iframeSrc” is set to “javascript:false” on https pages, Chrome now seems to cancel the request. Changing this to “about:blank” seems to resolve the issue
Later I fix this in the code and it seems to be working for me now.
var iframe = toElement('<iframe src="about:blank;" name="' + id + '" />');
I hope it will work for you as well. :)
Reference: https://www.infomazeelite.com/ajax-file-upload-is-not-working-in-the-latest-chrome-version-83-0-4103-61-official-build-64-bit/
If is there anything I am missing the do correct me.
This will fix the issue.
Old Code:
var iframe = toElement('<iframe src="javascript:false;" name="' + id + '" />');
New Code with chagnes:
var iframe = toElement('<iframe src="about:blank;" name="' + id + '" />');

Resources