myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barbalace, Richard" <RBARBAL...@PARTNERS.ORG>
Subject RE: JavaScript in jsCookMenu component?
Date Wed, 02 Nov 2005 21:19:42 GMT
Simon Kitching [] writes:
> I'd rather see detection of *any* protocol on  the front of the URL 
> rather than checking just for "http:". The protocols 
> "https:", "mail:" 
> etc are also useful.
> == proposal: ==
> The URL *always* has "menu_id:" on the start, so presumably the jscript 
> could just strip this ID off then look for a ":" before any occurrence 
> of "/" or "?". If that is present, then the URL is "absolute". And if 
> that is not present but the URL contains a "/" then it isn't an action 
> so treat that as a local URL.

I would have done something similar to that originally, but I was not sure how
consistent the "menu_id:" string was or if that string might change in the
future.  The string is actually "id0_menu:" in the version I am using, at least
for the first jsCookMenu element on the page.

That proposal sounds almost fine to me.  The code needs to check for only ":" in
the case of scripting languages.  For example, one of my actions is
"id0_menu:javascript:getHelp();", which contains no "/" character.  I am not
sure what the ideal regular expression would be, but it would definitely check
for ":", "/", and "?".  Perhaps that would be enough; can any of those
characters be used in a JSF action name?

+ Richard

View raw message