Simple question, I guess.
How to trigger mobileinit event at jQuery Mobile?
I get some Ajax response, which is not nicely designed (in jQuery Mobile form). And I guess I have to trigger this event to get it done.
you could try $.mobileinit(); in the jQM Library itself it's called like this:
$( window.document ).trigger( "mobileinit" );
I don't trust mobileinit. I am building a mobile app with Phonegap and jQueryMobile, currently testing on Android 4.0.3, and the event is just not firing. At all. It is correctly set up, since I can trigger it in the Chrome console while testing on desktop.
Binding to window instead of document makes no difference.
Of course I could trigger it in some other event handler like pagebeforecreate on the first page in the DOM. But that's putting the horse behind the cart.
Related
What can cause the start render to be delayed even after the load event has fired?
Look at this webpagetest result
This is most probably a bug. For the moment, the iPhone instance on WebPageTest is quite recent and the author is still improving it:
The iOS support is just becoming stable though it's still under VERY active development so don't be surprised if there are a few rough edges (and a lot more limitations than the android testing).
- Patrick Meenan, 09-09-2015
The android tests are much more reliable.
If you check the page you tested without javascript (F1 > Disable Javascript in Chrome DevTools), you can see that most images are lazy-loaded, which mean they are loaded via a JS script checking if the images are in the viewport. As you can see, without JS the load time line is well after all assets loaded.
Also for other assets, like JS, you can add an async or defer attribute to de-synchronize your scripts loads.
Finally, some scripts can be even deliberately loaded after the load event using an attachment on the window load event to write <script> tags in the body when it's triggered as loadJS do for example.
You should read that by the way to better understand how rendering and events timing work.
According to Google's app lifecycle docs
When the event page has no executing JavaScript, no pending callbacks, and no open windows, the runtime unloads the event page and closes the app.
I am seeing in my app that an onSuspend is being triggered, which also has the side effect of invalidating any FileEntry or DirectoryEntry references (an as-of-yet undocumented "feature"), only the onSuspend is triggered when I still have pending callbacks and open windows. Does anybody know which other conditions will trigger an onSuspend? Does it have to do with the app using too much memory?
It makes sense that onSuspend will be called when the event/background page has no activity and there are no windows open, but when else would onSuspend be called?
Is there a secret permission that I can use to disable onSuspend from being called? A background permission API in the works?
It should not be triggered if you have open windows unless something atypical is under way, like the user upgrading chrome.
If you are seeing onSuspend events at other times, that sounds like a bug. Please report at crbug.com with steps to reproduce.
I almost feel bad asking this stupid question, just upgraded to VS2012 from VS2008 and I started out by create a new Web Forms Application, and bang there you go a bunch of files and folders created. When I view the Register.aspx page, there's this line:
<asp:Button runat="server" CommandName="MoveNext" Text="Register" />
and when I run this application, it actually works, it creates a local DB and the user are inserted into that DB.
But HOW? I see no click events, I see no function in the code behind handling the MoveNext command, is this some kinda of new way of handling events? Where does the magic happen? Thank you guys
It seems like a bit of magic but it is part of the ASP.NET 4.5 Framework. It is the CreateUserWizard control on Register.aspx, there is an attribue called OnCreatedUser that wires up the code behind "click" event you are looking for. Should be called RegisterUser_CreatedUser.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.createuserwizard.oncreateduser.aspx
It's all part of the CreateUserWizard control. If you disassemble that class, you'll find a bunch of code that knows how to hook up to your markup. My guess is somewhere in there is something that attaches the MoveNext command to an event handler inside that user control.
When your button does a postback on the page, the lifecycle for the control is executed, so somewhere in that lifecycle is all the work.
I am trying to port a WinForms app for use with Mono, and I've recently noted that calling Form.Show() from another form will either do nothing or cause the new form to flash and disappear. I read something about the new form needing a message pump, which is accomplished with Application.Run(), but that's already been called. Any idea why this doesn't work? I can't use ShowDialog because my program relies on events fired by completed async tasks, and I don't want to block a ton of extra threads that will be done right after the Show call.
Have you tried to hide your current form before showing/displaying your new one?
Seems to me like your form is indeed being displayed but for some strange reason it's being delegated to the background. Worth a shot.
I develop a FB app using Flash using wmode="direct" (for 3D graphics).
In Internet Explorer, every time I popup any FB dialog (e.g Purchase Credits dialog), the flash disappears and when the dialog is closed, the flash does not re-appear...
I tried to set the visibility after dialog is closed:
http://developers.facebook.com/docs/appsonfacebook/tutorial/ (under "Special Considerations for Adobe Flash developers"), but it didn't work.
I've also tried the use FB.Init hideFlashCallback:
http://developers.facebook.com/blog/post/555/ (under "Detecting visibility of Flash objects in Canvas apps"), but it doesn't seem to call the callback function...
Any one had the same issue and manage to make it work?
Any other suggestions?
P.S - I use swfobject to embed the SWF file.
Thank a lot!
Roei
UPDATE: I removed the appId param from the FB JS url:
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js#appId=XXXX&xfbml=1"></script>
and now the hideFlashCallback is executed, but still - the flash does not re-appear...
I've updated the section Special Considerations for Adobe Flash developers because the code snippet was a bit out-of-date.
The new snippet should give you an idea of how to use the hideFlashCallback, whose semantics have changed since that now out-of-date blog post, in that the function now takes a flash element as an argument. (Unfortunately, we haven't redocumented it yet, but will soon). One thing to note is that the callback does not currently work on IE8, but will after a fix gets pushed next Tuesday.
That said, it should work without that callback. It may be caused by a javascript fatal that stops script execution before the re-showing happens. Look in your javascript console to see if you see any errors.
Otherwise, if you can give me the canvas URL for your application, I can look into it.
Did you try it with other wmodes? what you can try is actually remove the div where you write your flash to, add it with innerHTML and run the swfobject.embed again