Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:20
Right-click "open in a new window" functionality i
Poster: jcone
Dated: Monday August 11 2003 - 22:48:16 BST
Hi there, I am currently evaluating the ver5 (rc4) of the Milonic menu and I noticed that it doesn't seem to allow the user to right-click on a menu item (top level or sub-menu) and choose "Open in a new window".
This is a feature that I thought the ver3 menu code offered, and was one of the reasons I was considering the Milonic menu. Is this feature actually available in ver5 and just disabled? Or if not available can it easily be added?
If this functionality is available then I will definitely register the menu.
Cheers, Julian
Poster: Hergio
Dated: Tuesday August 12 2003 - 13:30:29 BST
Definetly something for Andy (the menu's creator) to implement into the menu. I never thought of that ( and it might be in there) but its a great idea. Do work around it, you can just have the URL be a javascript call to a function that opens a pop up window. This doesnt give the user the option to choose whether they want it in a new menu or not, but it at least forces a new window. Below is code from Andy's site where showed how to do it with the old version of the menu, but customize things to suite your needs. I got it from http://www.milonic.co.uk/menu/menusample.php?sampleid=16.
Code:
function openNewWindow(winURL,winWidth,winHeight,winConfig){
mmConfig=""
mmConfig="width="+winWidth+","
mmConfig+="height="+winHeight+","
mmConfig+=winConfig
var mmWin=open(winURL,"",mmConfig);
mmWin.focus();
}
mmConfig=""
mmConfig="width="+winWidth+","
mmConfig+="height="+winHeight+","
mmConfig+=winConfig
var mmWin=open(winURL,"",mmConfig);
mmWin.focus();
}
The above function should work fine without any modifications. All necessary parameters are passed from within the menuitems URL slot. Here is a sample menuitem URL to open a new window using default parameters. All you specify is the URL, the Height & the Width of your new Window.
Code:
url=javascript:openNewWindow(\"http://www.google.com\",600,400,\"\")
Poster: jcone
Dated: Tuesday August 12 2003 - 22:20:13 BST
That's a good thought Hergio but not quite the same thing. I don't want to force the user to have the link opened in a new window I just want the browser option that you get on any normal <a href> link to open the link in a new window (or tab in Mozilla/Netscape) to be available for links on the menu.
This functionality seems to be available on the current version of the menu on the main Milonic site (http://www.milonic.co.uk/menu/) but it doesn't work in ver5 (eg: http://www.milonic.com/v5_rc5/menu.htm).
I am hoping it's just a configuration change to enable it but maybe it hasn't been implemented in ver5 at all.
I haven't spent much time trying to work out what it is about a link that convinces the browser to show the "Open in a new window" option on the right-click menu but if someone can explain that then I can probably implement it myself if it's not already available in ver5.
Cheers, Julian
Poster: Hergio
Dated: Wednesday August 13 2003 - 14:08:37 BST
ok, try this then, maybe it will work. I haven't gotten a chance to test anything so take it with a grain of salt.
Try putting a hyperlink tag into the text of the menu item. Because what it is that makes a browser give the option to open something in a new window is that fact that you are right clicking on an <a> tag. so in your menu item put...
Code:
aI("text=<a href='default.asp'>Go Home</a>;url=default.asp");
Somethin' like the above if you get what I am saying. Basically you are putting the a tag in there so that on right click, you get the context menu you are looking for, but the url should still be the same as the href because I THINK the onClick event of the layer that makes up the menu cell will fire before the hyperlink tag registers a click. But I may be wrong. give it a try and let me know of your results.
Poster: jcone
Dated: Friday August 15 2003 - 3:42:07 BST
Thanks Hergio, man you are prolific on this board, do you ever sleep!?
I tried your suggestion of including the <a href tag in the text param for the menu item that and it does indeed work, in so far as it fools the browser into enabling the "Open in a new window" option on the right-click menu.
However it seems a bit of a hack to me to do it that way, surely it would be better to make one universal change in the menu source to enable this functionality for every link.
The maintenance issues associated with adding the href tag to the text param is quite substantial. One immediate issue I had was that my site-wide CSS link style applied to the new href tag so the menu text didn't use the menu styles, especially the onColor/onBGColor values, which caused some visual problems. I'm sure I could work around those by declaring the style param in the imbedded href tags but that is just another thing to bother with.
Thanks again for your efforts Hergio but I'd appreciate a comment from Andy on this one, since it appears that ver 3 of the menus handled it.
I am very happy with the menu in all other regards so it would be excellent to get this functionality sorted out and then I can commit to licensing and using the menu on our site.
Cheers, Julian
Poster: Hergio
Dated: Friday August 15 2003 - 19:49:17 BST
Thanks for the comments I appreciate it. Glad I could help you somewhat with your problem. I totally see your situation with the CSS/style conflicts. And maintaining all that in the code would be tough. I am sure Andy can put it on his list of features to implement, if not in v5.0, but maybe v5.1, eh? Good luck, and definetly invest in this menu, its worth it and the guy works his butt off on it.
Poster: jcone
Dated: Wednesday August 20 2003 - 1:09:02 BST
Andy, I'd really appreciate a reply on this one. At least an indication that the feature is not currently available but can/will be added.
Apart from this issue I have got the menu working how I want it, in which case I will register it once i hear about the status of this feature.
Cheers, Julian