How to know when WebView has refreshed due to JavaScript? - macos

My webView has an HTML page with JavaScript that changes the appearance of the page when button is pressed in the HTML page. I can have the hosting program receive a callback through JavaScript when the button is pressed, and I can change values on the web page side of things. However, when these callbacks are made, the appearance change of the page has not yet changed:
WebViw is loaded and frameLoadDelegate is called
??? WebView is rendered and displayed
Customer clicks on the button, JavaScript `onClick' calls a JavaScript function which makes appearance changes, and then calls my Objective-C function.
Objective-C function checks appearance of WebView
??? WebView is rendered and displayed
In Apple's WebKit framwork, a WebView that has finished loading its resources sends a webView:didFinishLoadForFrame: message to its frameLoadDelegate. However, this only means that resources have been loaded, not that rendering is done… How can I detect that the WebView rendering is done? Among all the delegates of WebView, I couldn't find one that has the method I would need…

Related

NativeScript Vue: What is the purpose of navigatingTo, navigatingFrom and other Page events?

I am trying to understand how a Page event like navigatedFrom would be used.
Here is a base template:
<Page #navigatedFrom="navigatedFunc">
<StackLayout></StackLayout>
</Page>
Say in my script sections, I had the function navigatedFunc listed in the methods sections:
navigatedFunc: function(args) {
// what would I do here or check against? How would you check against a specific screen title you navigated from?
}
would it be used to check the specific view you navigated from? Like can I do a conditional check in that function that would say if a user comes from the Account page, then do something?
Those events are used if you want to run some code when a page appears or disappears. If you're familiar with native iOS apps, they're like the viewDidAppear and viewDidDisappear methods.
The navigatingTo event triggers when entering the page where it is registered.
The navigatedTo event triggers when when the navigation to the page has finished.
The navigatingFrom event triggers when a navigation away from the page starts.
The navigatedFrom event triggers when the navigation away from the page finished.
This image from the NativeScript documentation might help you visualize the flow:

Jquery mobile - scroll to bottom automatically after page is loaded

I'm building a peer-to-peer chat. Whenever I open the chat (means after server-roundtrip) the suiting jsp will be displayed decided by a spring-controller. The latest chat comment is at the bottom of the scrollable page.
Unfortunately when page is loaded there's no reaction to the jquery method like
$(document).scrollTop(1000);
to get to the bottom of the page.
I also put this method inside pageInit and pageBeforeShow events of jqm. But in vain.
What's wrong?

How to implement Progressbar for Android WebView in Ajax Calls

I implemented Progress bar loader for android web view,
But the progress bar not dismissed after the response came in AJAX calls.
Whenever I clicked ajax calls based link in that site,progress bar appearing but not dismissed ,after getting the response also.
How can I overcome this.

Is there a way to make Omniture capture the url/page loaded via ajax as a "Load" event and not a "Click" event?

I am currently working on a Ajax based mobile website project and am not able to get Omniture to work correctly. Here is a brief detail of the problem.
Assume a mobile site which has multiple pages, like example.com/a, example.com/b, example.com/c, example.com/d, example.com/e, example.com/f, etc.
Each page of the site, has Omniture's code, like:
<html><head></head><body>
<script type="text/javascript" src="//domain-and-path-to-omniture-code-files/s_code.js">
<script type="text/javascript">
s.pageName = "blah";
// some other ... s.blahBlah ... properties here...
/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code=s.t();if(s_code)document.write(s_code);
</script>
<div id="content">SOME CONTENT</div>
</body>
User opens the browser and opens one url/page, like example.com/a
The page (example.com/a) has multiple links to the content on the same page, like #topic1, #topic2, #topic3, etc. and also has links to other static pages of the site, like example.com/b, example.com/c, example.com/d, etc.
I use jQuery to control click events on these links.
When user clicks on a named link, like #topic1, #topic2, etc., the page is animated/smooth-scrolled to the target element/content-section; and Omniture's "s.tl()" function is triggered, to track/capture the click event with relevant/required details.
## THIS IS THE PROBLEM AREA ## When user clicks on a link to a different static page, like example.com/b, example.com/c, etc., instead of allowing the browser to do a full page-load, the Ajax version of the target page is loaded into the content holder (by Ajax version, I mean to say that the page only has bare-minimum markup/content and not the entire html/head/common-css/js includes/etc).
Now the problem is that, when the page is loaded normally, Omniture captures it correctly as a "Load" event, but when it's loaded via JavaScript/Ajax, Omniture captures it as a "Click" event!
The Ajax/version of the page, does not include Omniture library "s_code.js" JS again (for obvious reasons, its already there on the parent/main page). Along with the required content, this page only has a script-tag, which sets required "s.blahBlah" values for the new page and the call to "s.t();".
I also tried to keep the Omniture code separate, in a common JS file, which is already loaded with the parent page, and only set the required "s.blahBlah" values in the Ajax call/function (which is also in a global/already loaded JS file), but still Omniture captures it as a "Click" event.
// s.tl(); ... gets captured as a click event
// s.t(); ... on normal page load... gets captured as a load event
// s.t(); ... after DOM-ready/page loaded via Ajax... gets captures as a click event
Any ideas! How can I make Omniture capture a load event? Is there a function like "s.l()" or something to trigger Omniture's "Load" event on demand.
The problem was not Omniture capturing it incorrectly, it was the tool "Omnibug", which I use to see the requests.
Omnibug 0.5.448 logs all "s.t()" calls made before page load event as Omniture "Load" event and any "s.t()" call made afterwards is captured as "Click" event.
Apparently, I was not the only one facing this issue. Others had already reported this to the developer of Omnibug (https://github.com/simpsora/omnibug/issues/4) and a fix has been made by him/a new version Omnibug 0.5.500 has been released.
The new version of Omnibug 0.5.500 captures all "s.t()" calls as "Load" events correctly and all "s.tl()" calls as "Click" event.
Thanks!

html5 audio + javascript + ajax

I have a problem to keep working the controls of a player in html5 "" via javascript on the page after an ajax request occurs.
When the page is loaded, the player starts playing and "Play, Pause, Next, Prev" controls work, but after I access any other page with ajax request, the controls no longer work.
The controls are within div.content which has its recharged every ajax request content.
If they want to see in practice http://devintec.com/dev/jjsv
Probably you're attaching your event handler after page load, so whenever the controls div is updated, the event handlers disappear (because the DOM elements that had them attached are removed). You'll have to attach the event handlers again after your AJAX call completes, or use event delegation.

Resources