You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by mo...@comcast.net on 2014/01/23 05:26:15 UTC
setting page title dynamically using ExternalInterface.call()
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
Re: setting page title dynamically using ExternalInterface.call()
Posted by mo...@comcast.net.
Thanks Lee, You are correct! The following works:
var titleStr:String="window.document.title='"+userName+"'";
ExternalInterface.call("eval(" + titleStr + ")");
----- Original Message -----
From: "Lee Burrows" <su...@leeburrows.com>
To: users@flex.apache.org
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, modjklist@comcast.net 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
Re: setting page title dynamically using ExternalInterface.call()
Posted by Lee Burrows <su...@leeburrows.com>.
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, modjklist@comcast.net 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
Re: setting page title dynamically using ExternalInterface.call()
Posted by Alex Harui <ah...@adobe.com>.
BrowserManager?
On 1/22/14 8:26 PM, "modjklist@comcast.net" <mo...@comcast.net> 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