It takes more than one javascript to get the context menu to open a new tab. Note that the tab system I use is not the same as the Microsoft - Delphi module. (Internet Explorer they say can open 300 tabs before crashing). I can have 20 or 30 hidden Neobook buttons that become visible and resize as "tabs," then load a corresponding web browser object. The first javascript goes in the "Navigation Complete" section of each web browser object as a "BrowserExecScript" javascript string. It does NOT prevent the default opening of the right click menu, but triggers the Neobook publication before the menu appears. It executes a subroutine "getStatus" which gets the last URL (if any) that was right-clicked upon (via the browser status) and then sets it as the variable "TabLastStatus."
---------------------------------
javascript 1
------------
- Code: Select all
if (window.document.addEventListener) {
window.document.addEventListener('contextmenu', function(e) {
window.external.nbExecAction( 'GoSub "getStatus"' );
// e.preventDefault();
},
false);
} else {
window.document.attachEvent('oncontextmenu', function() {
alert("You've tried to open context menu"); //here you draw your own menu
window.event.returnValue = false;
});
}
-------------------------------------
Neobook subroutine:
-------------
- Code: Select all
:getStatus
SetVar "[TabLastStatus]" "[WebBrowser[X]Status]"
Return
----------------------------------------

The second javascript does not go directly into the Neobook pub but is an external file accessed by the Windows registry. I used a freeware program to add the new item "Open in Neobook tab" to the IE right-click menu. (This context menu item can be automatically added to the Windows registry when the publication starts and automatically removed when the publication exits.) Clicking on "Open in Neobook tab" launches a html file that runs a tiny Neobook system tray app. The tray app identifies the Neobook parent "[theAppID]" and opens a new tab with "[TabLastStatus]" as the corresponding URL.
--------------------------------------------
javascript2 (External HTML)
---------
- Code: Select all
<html>
<head>
<title>Application Executer</title>
<HTA:APPLICATION ID="oMyApp"
APPLICATIONNAME="Application Executer"
BORDER="no"
CAPTION="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
SCROLL="no"
WINDOWSTATE="normal">
<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/MyProgram/NewTab.exe", 1, false);
};
</script>
</head>
<body>
<script type="text/javascript" language="javascript">
RunFile();
</script>
</body>
</html>
------------------------------------
So anyway,
IT IS POSSIBLE to have tabbed browsing with Neobook, including a right-click menu action.
I am looking for ways to make it better, perhaps with fewer steps involved...
Instead of using a system tray app to open a new tab, I would rather have a command line switch directly to the parent Neobook publication. Is there any way of adding command line switches (myprogram.exe \s) to Neobook?
.