Omniture object "s" is not available immediately - adobe-analytics

I'm trying to track Page Load Event. I'm getting utag.js from Omniture.
I'm also wrapping it with jQuery: $.getScript to make sure that script is loaded.
But even then if I try to set my s.pageName or s.t(); I'm getting error that s is undefined. If I put a 500 ms timeout everything works fine. But I'm surprised that I need to wait even after script is loaded. Is it a common practice with Omniture?
I'm new to the Omniture, it might be very obvious thing for the more experienced users of Omniture.

utag.js is a Tealium loader, which I assume has Adobe Analytics code within it. The only thing that would prevent s from being defined after utag.js being loaded would be that the appmeasurement code is being loaded asynchronously.
You can find more about asynchronous loading here: https://tealium.com/blog/standard/asynchronous-tagging/
I would expect that once you switched to synchronous loading, the variables after utag.js will be able to reference the appmeasurement library.

App Measurement is not designed to be loaded asynchronously. I would suggest adding a "flag" that will indicate when utag.js has loaded and then reference the s.object.

Related

Vaadin23: Expected router outlet to be a valid DOM Node (but got null) and HomeView rendered several times in production mode

when I run our vaadin 23 app in production mode, I get following error in the browser console, while the corresponding site is rendered twice:
Uncaught (in promise) TypeError: [Vaadin.Router] Expected router outlet to be a valid DOM Node (but got null)
First it's rendered with a corrupt textfield (UI written in Vaadin); the second page looks fine. When I try to debug (IntelliJ), it gets rendered correctly, so I added log messages, where I learned, that the HomeView gets initialized even three times, whereas in dev mode it is initialized once. I find it hard to figure out why, since that is run in a thread (I'm far from knowing Vaadin well).
We have two apps, a backoffice and a webshop. The non-responsive backoffice does not show this issue, only the webshop. The webshop also uses two lit web components (but even when I comment them out, I have the same error). The rest is all kept in Java.
Does anybody have an idea how to solve this, or in what direction to search and debug?
Thanks a lot! Sura
This is likely caused by a known bug with the eagerServerLoad flag. As a workaround, try disabling this flag to prevent the issue.
Add vaadin.eagerServerLoad=false to application.properties to disable the flag, assuming that your application uses Spring Boot. You could find alternative ways of setting the property see the Configuration Properties article.

UI5 UploadCollection Issue

I have an UploadCollection in my XML view bound to a JSONModel. When I add / delete files in the collection all works good initially. When I save the required data to the database and then refresh the JSONModel from the database I get the attached error. It is as if the elements are not being removed from the DOM, however, when I look at the entire process via the Chrome debgugger the elements are indeed gone in between. I am currently using OpenUI5 v1.78.1 but the same issue occurs with the latest (v1.86.3). The UploadCollection fails to work again from then on and I need to destroy it in my view before the data will be displayed again.
Has anyone seen this or have advice on how it may be corrected?
I figured it out. It appears that when I was calling UploadCollection.removeItem(item); it did not unregister the element somewhere and held onto the idea that the HTML elements still existed. Using item.destroy(); instead solved the issue.

How do I cause WKWebView to execute webView:didFailNavigation?

I'm writing a wrapper component for WKWebView and I'd like to make sure I cover my bases for error handling.
The documentation for webView:didFailNavigation simply states Called when an error occurs during navigation. What exactly does the documentation writer mean when they say "navigation?"
I'm aware that there's also webView:didFailProvisionalNavigation, which executes whenever there's a loading error. The documentation for that hook states Called when an error occurs while the web view is loading content. I can make this trigger by calling [_webView loadRequest:request], where request contains a malformed URL.

Can I use gBrowser.selectedBrowser.addProgressLisnter in e10s?

We're trying to migrate our add-on to message manager and frame scripts.
Previously our add-on used gBrowser.addProgressListener() and nsIWebProgressListener.onStateChange() along with browser.webProgress.isLoadingDocument to monitor network activity.
The question is can I continue using browser.addProgressListener and browser.webProgres.isLoadingDocument in future versions of Firefox or using webProgress from frame script is a better way to do that? Maybe I should use some other technique?
For some reason it doesn't work reliably in Firefox 36.0a1 so I thought I should maybe move the code to frame script. Namely frame's docShell is QI-ed to webProgress to add progress listener there. It also doesn't work in all cases so I guess it's just a bug in 36.0a1.
By "doesn't work reliably" I mean that onStateChange() isn't called when I try navigating by browser.loadURI() method when a blank page is loaded in the current tab. Also webProgress from frame script sometimes "forgets" to send STATE_STOP to onStateChange().

Firefox Extension Execution Priority

I couldn't find it anywhere on Mozilla's documentation. Suppose I code an extension that uses addEventListener on keypress. What is the execution priority if a webpage contains a JS code that calls addEventListener on keypress (or keydown) too? Is it guaranteed that my extension receives the event first?
The event first goes through a "capturing" phase, then a "bubbling" phase. If you use the capturing phase (by putting true as the last parameter to addEventListener) then your listener will get called before the one on the page, if the one on the page uses the bubbling phase. I guess if you don't know which way it works on the page, then you could just attach it to something out of reach of the page (like the browser object, or even gBrowser) and then you would be sure that yours goes first. See http://www.w3.org/TR/DOM-Level-3-Events/#event-flow

Resources