Technical support This forum is closed.
Version 1.x > Technical support > Opening JavaScript Page (Menu item)s from search results View modes: 
User avatar
Member
Member
ta5ae - 3/29/2006 10:10:37 AM
   
Opening JavaScript Page (Menu item)s from search results
I found that opening Page (menu Items) which were of the type JavaScript did not work very well.

I use this option a lot to open links in a new window.

I did the following execute the JavaScript of the Page (Menu Item) instead or trying to navigate to the Page (Menu Item).

...
const int JS_MENU_ITEM_TYPE = 3;
const string SEARCH_PAGE_URL = "~/Search";

// JavaScript test
TreeNode currentNode = tree.SelectSingleNode(redirectPath, TreePathTypeEnum.AliasPath, "cms.menuitem", true);

if (currentNode != null && currentNode.ClassName == "cms.menuitem" && (int) currentNode.GetValue("MenuItemType") == JS_MENU_ITEM_TYPE)
{
string jsCommand = (string) currentNode.GetValue("MenuItemJavaScript");

Response.Write("<script language='javascript'>" + jsCommand +
";document.location.href = '"+ ResolveUrl(SEARCH_PAGE_URL) +
"'</script>");
}
else if ( addExtension )
...

Normally this will execute the JavaScript command and redirect the user to the search page a fresh.

Hope this is helpful to anyone who uses JS Page (Menu Item)s like I do.

User avatar
Guest
admin - 3/29/2006 8:50:01 PM
   
Re: Opening JavaScript Page (Menu item)s from search results
Thank you for posting this. We will try to improve this issue in some of the next releases.

Best Regards,