webkkit eventhandler for ajax calls - ios

I have an aspx file, in which a button calls for javascript funtion. inside the javascript function i am making an ajax request. which will be opened inside an inappbrowser cordova plugin for ios.
this ajax request changes the DOM. is there a webkit eventhandler which i could use to handle the request inside inappbrowser.

Related

Electron, how to execute remote javascript function using ipcRenderer

I have an Electron app wrapping a remote site, and it works wonderfully.
I'm author and have access to all of the code in both ends.
I use contextBridge and ipcRenderer to send messages from the remotes clientside javascript to the electron app.
Using webContents.send and ipcRenderer I can also access the entire dom so I can use the remotes javascript functions indirectly. Fx with this code snippet:
ipcRenderer.on("message", (e, args) => {
switch (args.action) {
case "logout":
document.querySelector(".btn-logout").click();
break;
...
the above "click" is triggering an eventlistener which calls a "logout"-function.
But is it possible to access the clientside javascript functions of that remote site directly?
I simply want to get my Electron app to call a function that's defined in the remotes clientside javascript. So instead of triggering a click on the logout button, I would simply like to call the logout function. But I don't know howto.
Thanks in advance!

Respond with JS to an iframe file upload

I have an iframe that uploads a file to rails
I want to respond back with javascript. The format that comes in is html
I tried
<script>
// JS code
</script>
But it loaded a new page and then executed the JS
Key is to upload a file asynchronously and then do more things on the page
Gem remotipart seems nice but i want to keep dependencies low
Look into Window.postMessage() for cross-origin communication. Refer to this post Html5 - Cross Browser Iframe postmessage - child to parent? to learn how to send child-to-parent page messages.

deviceready event not consistently firing for non-index.html page

I'm loading an external URL with PhoneGap 2.5, and trying to figure out why the deviceready event isn't consistently firing. There are a bunch of threads that all involved people not correctly adding the handlers, but I've done the following:
Put an onload handler on body where I do document.addEventListener("deviceready", onDeviceReady, false);
Used jQuery's document.ready function to set the event listener.
Called setTimeout in a loop waiting on navigator.splashscreen.
When does the deviceready event actually fire? Does loading a non-index.html page cause weird interactions? I see messages like Resetting plugins due to page load. and I'm wondering if that causes other problems.

coldfusion ajax return unstyled content with jquerymobile

I am following Ray Camdens post on ajax calls in coldfusion. I have the whole page wrapped with jquerymobile and themeroller. If I put the content on the main page, its styled properly, but if I use ajax to return the content, its unstyled.
I have tried including jquery and jquerymobile scripts in the ajax page, but then I end up getting weird loops and double submit buttons. In firebug I can see that it loads the js files in the ajax return. I also loose my focus on the submit button which is a big deal in this particular app.
Is there a way to only have the jquery a jquery mobile js files linked in the main page and then have the styling refresh after the ajax content is loaded? or will i run into a FOUC?
Fixed. used $("#result").html(data).trigger("create"); as mentioned in the comments on this page

jquery mobile canceling 302 redirect to external site

I'm trying to integrate DotNetOpenAuth with a site that uses jquery mobile. I'm running into an issue where jquery mobile appears to be canceling a 302 redirect to the providing party (an external site) that the server is responding with.
I've tried turning off the default jquery mobile ajax handling with the following in the mobileinit event:
$.mobile.ajaxEnabled = false;
If I take jquery mobile out of the picture the 302 redirect is handled correctly and the OpenID integration with the providing party works fine.
Can anyone tell me how to make jquery mobile correctly handle the 302 redirect to an external site?
For forms just set "data-ajax" attribute to false.
It should be like this:
<form action="postthis" method="post" data-ajax="false">
This will disable default ajax handling of jQuery mobile.
Reference: http://jquerymobile.com/test/docs/forms/forms-sample.html
I had the same problem and was able to login after adding rel="external" to the login link, see example below
Login
I'm not sure if this is the solution you are looking for?
To disable Ajax you should add this script just before the script reference to jquery mobile:
<script language="javascript" type="text/javascript">
$(document).bind('mobileinit', function () {
$.mobile.ajaxEnabled = false;
});
</script>
Redirecting to an external url does work if you don't use Ajax.
But there should be an alternative where you don't need to disable Ajax.

Resources