Reputation: 35276
When I inject javascript this way:
ScriptInjector.fromString("var WRInitTime=(new Date()).getTime();").inject();
ScriptInjector.fromString(Resources.instance.clicktaleScript().getText()).inject();
I can see that the script injected was in a IFRAME. What is the GWT approach in injecting Javascript code? Considering that the pages are "Ajax" or Dynamic. The goal is to make Clicktale script be able to record browser events just like how it works for normal HTML pages, making this work with Dynamic website with Ajax data is quite hard.
The actual JS Script are:
<!-- ClickTale Top part -->
<script type="text/javascript">
var WRInitTime=(new Date()).getTime();
</script>
<!-- ClickTale end of Top part -->
and
<script type='text/javascript'>
// The ClickTale Balkan Tracking Code may be programmatically customized using hooks:
//
// function ClickTalePreRecordingHook() { /* place your customized code here */ }
//
// For details about ClickTale hooks, please consult the wiki page http://wiki.clicktale.com/Article/Customizing_code_version_2
document.write(unescape("%3Cscript%20src='"+
(document.location.protocol=='https:'?
"https://clicktalecdn.sslcs.cdngc.net/www02/ptc/1239e635-ed5c-4c26-81a7-5eedf55952f0.js":
"http://cdn.clicktale.net/www02/ptc/1239e635-ed5c-4c26-81a7-5eedf55952f0.js")+"'%20type='text/javascript'%3E%3C/script%3E"));
</script>
<!-- ClickTale end of Bottom part -->
Upvotes: 1
Views: 1838
Reputation: 16060
I am not 100% sure, what your problem is, but if you want to access the same frame as the GWT Application you will need to set the correct Window object:
ScriptInjector s= ScriptInjector.fromString("var WRInitTime=(new Date()).getTime();");
s.setWindow(ScriptInjector.TOP_WINDOW);
s.inject();
http://www.gwtproject.org/javadoc/latest/com/google/gwt/core/client/ScriptInjector.FromString.html
Upvotes: 3