Thanks Lee, You are correct! The following works:
var titleStr:String="window.document.title='"+userName+"'";
ExternalInterface.call("eval(" + titleStr + ")");
----- Original Message -----
From: "Lee Burrows" <[email protected]>
To: [email protected]
Sent: Wednesday, January 22, 2014 8:55:48 PM
Subject: Re: setting page title dynamically using ExternalInterface.call()
could the problem be the quote marks?
your example becomes
...call("eval('window.document.title='myUsername')'"); and eval argument
string has inner and outer sets of '' - if JS is fine with that, ignore
me ;)
On 23/01/2014 04:26, [email protected] wrote:
> Anyone know how to dynamically set the page title? I've seen various posts
> using ExternalInterface, but haven't been able to get it working with
> variables (hardcoded strings work fine though). Here's my latest attempt:
>
> var titleStr:String="window.document.title='"+userName+"'";
> ExternalInterface.call("eval('" + titleStr + "')");
>
> Running this doesn't update the existing page title text.
>
> [I prefer not to require a javascript function in HTML, and also prefer to
> avoid browserManager.]
>
> Is there a simple way to get variables included somehow using
> ExternalInterface?
>
> Some related blogs:
>
> http://forums.adobe.com/thread/1012175
>
> http://flexdevtips.blogspot.com/2008/12/dynamically-changing-browser-title-in.html
>
>
--
Lee Burrows
ActionScripter