I don't want to use a popup. How do I open Internet Explorer in RunInRectangle / CustomWindow? Or how do I send the JS "document.writIn" code to a Neobook WebBrowser object? In that case, what should "win=window.open" be replaced with?win = window.open('about:blank','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=300');
win.document.open("text/html","replace");
win.document.writeln("<HTML><HEAD><TITLE>My Test Page</TITLE>");
win.document.writeln("</HEAD>");
win.document.writeln("<BODY BGCOLOR=FFFFFF>");
win.document.writeln("<FONT face=Tahoma size=2 color=000000>");
Javascript window.open question
Moderator: Neosoft Support
Javascript window.open question
The following Javascript opens Internet Explorer in a popup window
Re: Javascript window.open question
fkapnist:
From the Help file ...
Also from the Help file ...
The CustomWindow command syntax is ...How do I open Internet Explorer in RunInRectangle / CustomWindow?
Code: Select all
CustomWindow "title" "left" "top" "object name" "options"
... so at Design time, you can place a Rectangle outside your visible pub window ... and populate it with a WebBrowser object ... and at Run time, you can invoke the CustomWindow command with appropriate/desired parameter values.The Container object is primarily intended to be used as a surface for other objects. It’s similar to a group, except that objects placed on a container can be moved and edited easily. This makes the Container an excellent tool for creating sizeable publications and custom windows.
To add a Container to your publication, use the mouse to draw a rectangle where you would like the object to appear. Other objects can be attached to a Container by selecting a tool from the Tool Palette and drawing directly onto the Container’s surface. (You can even attach other Containers.) Existing objects can be moved onto a Container by cutting and pasting them from the clipboard. When using this method, make sure that the container is selected before choosing paste. To move an object off a container, select the object, cut it to the clipboard, make sure no other objects are selected, then paste. Once an object is attached to a Container, the two become linked. Moving the Container also moves any attached objects. Similarly, deleting a Container also deletes any attached objects.
You can modify a Container by right clicking the object. The Container Properties screen will be displayed, allowing you to define the object’s appearance and behavior.
Also from the Help file ...
... so you might consider using such subroutines to populate the contents of the WebBrowser object in the CustomWindow ... take a look at the BrowserLoadFromStr command for this.You can define special subroutines that will be executed when a specific custom window is opened or closed. To do this, simply create two subroutines - one called ObjectName_OnOpen and one called ObjectName_OnClose. Replace ObjectName with the name of object used when opening the window. For example, the subroutines for our Container1 sample above might look like this:
:Container1_OnOpen
AlertBox "Hello" "The window is opening."
Return
:Container1_OnClose
AlertBox "Hello" "The window is closing."
Return
Re: Javascript window.open question
This is a javascript that runs a Neobook Action... so what should "win=window.open" be replaced with?
Re: Javascript window.open question
fkapnist:
The suggested solution is to use CustomWindow as the (simulated) popup window.
Say the WebBrowser object in the Container is called WebBrowser6 ... then your command ...
... will populate the WebBrowser object with this content.
And if the Container object that hosts the WebBrowser object is called Container3, then this subroutine ...
... will make sure that the desired HTML is loaded each time you invoke the CustomWindow command in your pub.
... command somewhere on that page (e.g. PageEnter event section or Click of a Button etc.).
The javascript pops up a new (IE) window and loads the following content within it ...This is a javascript that runs a Neobook Action... so what should "win=window.open" be replaced with?
Code: Select all
"<HTML><HEAD><TITLE>My Test Page</TITLE></HEAD><BODY BGCOLOR=FFFFFF><FONT face=Tahoma size=2 color=000000></BODY></HTML>"
Say the WebBrowser object in the Container is called WebBrowser6 ... then your command ...
Code: Select all
BrowserLoadFromStr "WebBrowser6" "<HTML><HEAD><TITLE>My Test Page</TITLE></HEAD><BODY BGCOLOR=FFFFFF><FONT face=Tahoma size=2 color=000000></BODY></HTML>"
And if the Container object that hosts the WebBrowser object is called Container3, then this subroutine ...
Code: Select all
:Container3_OnOpen
BrowserLoadFromStr "WebBrowser6" "<HTML><HEAD><TITLE>My Test Page</TITLE></HEAD><BODY BGCOLOR=FFFFFF><FONT face=Tahoma size=2 color=000000></BODY></HTML>"
Return
If all you want to do is have this HTML run in a WebBrowser object (on some page of your pub), just invoke the ...Or how do I send the JS "document.writIn" code to a Neobook WebBrowser object? In that case, what should "win=window.open" be replaced with?
Code: Select all
BrowserLoadFromStr "WebBrowser6" "<HTML><HEAD><TITLE>My Test Page</TITLE></HEAD><BODY BGCOLOR=FFFFFF><FONT face=Tahoma size=2 color=000000></BODY></HTML>"
-
- Posts: 419
- Joined: Thu Oct 15, 2009 3:43 pm
Re: Javascript window.open question
I think he may need something different...
Why don't you explain what you want to achieve, so we don't need to speculate? What javascript? Where and how it runs? Maybe the question is "how to run Neobook action from javascript?" etc...This is a javascript that runs a Neobook Action... so what should "win=window.open" be replaced with?
Re: Javascript window.open question
fkapnist:
... +1Why don't you explain what you want to achieve, so we don't need to speculate? What javascript? Where and how it runs? Maybe the question is "how to run Neobook action from javascript?" etc...
Re: Javascript window.open question
OK... Here is a snippet of javascript that creates a RSS reader on the fly and opens it in a new browser window:Tony Kroos wrote:I think he may need something different...Why don't you explain what you want to achieve, so we don't need to speculate? What javascript? Where and how it runs? Maybe the question is "how to run Neobook action from javascript?" etc...This is a javascript that runs a Neobook Action... so what should "win=window.open" be replaced with?
Code: Select all
var link = document.createElement('a');
link.setAttribute('href', entries[i].link);
link.setAttribute('target','_blank');
var text = document.createTextNode(title);
link.appendChild(text);
I want to change "_blank" to WebBrowser1. But I can't get the right javascript syntax for it... Most of that script comes from a Google API so I can't use another function or change it much
Re: Javascript window.open question
fkapnist:
Sorry, your response does NOT help much but ...
a) the short answer is ...
b) you can invoke javascript on the current document in a WebBrowser object using ...
... see the Help file for details.
Sorry, your response does NOT help much but ...
... if the document containing the link is hosted in the same WebBrowser1 object, then ...I want to change "_blank" to WebBrowser1. But I can't get the right javascript syntax for it.
a) the short answer is ...
Code: Select all
link.setAttribute('target','_self');
Code: Select all
BrowserExecScript "WebBrowser1" "[yourScriptGoesHere]" "JavaScript"