Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

javascript for opening a new window without a toolbar

New Here ,
Oct 04, 2006 Oct 04, 2006
Hi,

Does anyone have the code for opening a new window without the toolbar.

(It's the 'without the toolbar' part that's the problem. I can open a new window succesfully using the standard command of Open Movie - New).

I would need the complete line(s) of javascript that I would actually paste into the Clickbox's 'Exectute Javascript' window because any code I've ever tried in that window has never worked.

Thanks,

Kim
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2006 Oct 04, 2006
http://www.google.com/search?q=javascript+open+new+window+no+toolbar

Kim S. wrote:
> Hi,
>
> Does anyone have the code for opening a new window without the toolbar.
>
> (It's the 'without the toolbar' part that's the problem. I can open a new
> window succesfully using the standard command of Open Movie - New).
>
> I would need the complete line(s) of javascript that I would actually paste
> into the Clickbox's 'Exectute Javascript' window because any code I've ever
> tried in that window has never worked.
>
> Thanks,
>
> Kim
>

--
Erik Lord
http://www.capemedia.net
Adobe Community Expert - Authorware
http://www.adobe.com/communities/experts/
------------------------------------------------------------------------
http://www.awaretips.net - samples, tips, products, faqs, and links!
*Search the A'ware newsgroup archives*
http://groups.google.com/group/macromedia.authorware
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 04, 2006 Oct 04, 2006
Hi Kim,

The solution is in two parts:

When you create your animation, on the slide where the browser window is to open, you create a “hot spot”. In Captivate this is a “click box”. Go to Captivate -> Insert -> Click box.
For the click-box properties, for On success -> select “Execute Javascript”, for function call (the next properties field, called “Continue”) insert this string of text (no spaces):

MM_openBrWindow('the_link_URL.html','','width=200,height=200,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes')

Set your other “click box” attributes as you want

In the string (above) you can alter the characteristics of the window that is opened.
In the code string change the characteristics of the window by changing the flags:
For width of window: width=whatever number of pixels
For height of window: height=whatever number of pixels
For no toolbar: toolbar=no
For no menubar: menubar=no
For no scrollbar: scrollbars=no
For not being resizeable: resizable=no

Now you complete your animation, you can’t test this until you have a HTML page “wrapper” for the swf file.

The reason your javascript didn't work in the "Execute Javascript" window in the past might be because you can only put the "call" to the javascript in that window. Not the entire javascript (which includes the function and the call.)

When your animation is complete, you publish your .cp file. This creates several files, two of which are the .swf file and the other is an HTML file.

Using a text editor or a HTML editor such as Dreamweaver, open the HTML file. Locate the HEAD of the HTML file. (This will be between the <HEAD> and the </HEAD> tags.)
There will be a title tag (<TITLE>My Animation</TITLE>) After the closing title tag (</TITLE>) but before the closing head tag (</HEAD>), place this javascript:

<script type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>

Save and close the editor. Now, test the page by launching it. (You may have to upload the HTML and SWF file to a web server to do so, depends on you local computer configuration.)
When you reach the slide with the clickable area that is the javascript, click that area. A window should appear with the contents of the URL that you gave it. The URL (in the code string should be fully qualified. If you are accessing a page that is in the same directory as your animation HTML it would be: “the_link_URL.html”. If the page is in another directory it might be: “directory/the_link_URL.html”, “/directory/the_link_URL.html”, “../directory/the_link_URL.html”, etc.

If I am going to be using a lot of javascripts, and I do all the time (to pass data to the LMS) I have what is called an “include file” that I use. This “include file” contains only javascript functions, and there might be dozens.
Example:
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

I then just include this file in the head of the HTML document rather than the single function.

For example, I might have a file called “codebase.js” that contains all my javascript functions, including the openBrWindow() function.
I can call that function anytime, on any slide, in any animation by inserting a “include” statement in the head of each HTML that I create using Captivate. The “include” statement might look something like:

<script language="JavaScript" src="../global/scripts/codebase.js"></script>

In this case the codebase file is located in: a directory called “scripts”, which in turn is located in a directory called “global”, which is located in the root directory of the web server.
If this hasn't been too confusing, in my ramblings at 6:00 in the morning, give this a try.

I Hope this helps,

TPK
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 06, 2006 Oct 06, 2006
Hi TPK (or anyone else),

Still no luck. My javascript link is as flat as a pancake. Doesn't do a thing. I've also gone on the internet and looked at other code, so I understand the concepts, and I think I understand the concepts, but still no luck.

Can you see anything? (sorry, I'm using a different function name than the one you mentioned. Just one of the many many codes I've pasted in in my failed efforts).

NOTE: Near the bottom of my htm file, I call my swf file through a js function and it uses the document.write command to get rid of the Active X problem. That doesn't make a difference, does it?

Thanks in advance

Kim

_______________

In Captivate:
Open_Window('help.htm','','width=800,height=750,toolbar=no,menubar=no,scrollbars=no,resizable=yes')

In my help.htm file:

<!-- saved from url=(0013)about:internet -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
" http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;

charset=utf-8">
<title>Help</title>
<script type="text/JavaScript">
<!--
function Open_Window(theURL,winName,features){ //v2.0
window.open(theURL,winName,features);
}//-->
</script>
<script>window.resizeTo(800,750);self.moveTo(264,0)</script>

</head>

<body topmargin = "0" leftmargin = "0" marginheight= "0"

marginwidth = "0">

<center>

<script src="0_script_front.js"></script>
<script type="text/javascript">fr1();</script>

<center>
</body>
</html>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 07, 2006 Oct 07, 2006
Hi Kim,

Hmmm. Your function looks fine.
Are you firing the page from a web server? Or trying to produce it locally?

I always upload the pages to a server for testing. (Unless you have your local machine running IIS services, which corporate envrionments normally don't allow.)

I'm a little unsure about the
<script>window.resizeTo(800,750);self.moveTo(264,0)</script>
You could try commenting out this line and see if it fires properly.

In the javascript window in Captivate, does the script call have any spaces in it or at the end of it? If so remove any spaces, they will interfere with the script execution.

Have you used this script successfully before?

Do you get any error messages? Do you get nothing, no response? Do you get a blank window?

TPK
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2006 Oct 07, 2006
Hi TPK,

I run my page locally, and I don't have IIS running on my PC (as far as I know). Is IIS required to make JavaScript run? How come my Javascript calls from HTML files work like my document.write function?

I didn't have any spaces in my Captivate command.

And I tried deleting the spurrious window.resize command (a leftover from previously failed attempts).

The only scripts I use successfully are the document.write scripts to get over the Active X problem. I've never ever used a script successfully from Captivate. Never.

Always absolutely no response whatsoever. Dead as a doornail. No blank window. Nuthin.

Any other ideas? Or do you think IIS is required (although I use my JavaScripts outside of Captivate).

Thanks for everything so far. At least I understand the syntax I need to enter in the window and file now. (and yes, in the beginning, I didn't have the function and the call, but only one half of it).

If no other ideas come up, I can always run a window with a toolbar using the standard Captivate command. And then try again later (much later by the sounds of it) with Captivate 2. It also sounds like it's time for me to ask work to give me a webserver space.

Thanks for everything, unless you have other ideas.

Take care.

(And yeah, sitting here in the middle of a forest doing my work, you have no idea how nice it is to get help!)

Kim
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 07, 2006 Oct 07, 2006
Hi Kim,

You're in the middle of a forest?!? Wow. I hope the weather is good!

I'll need to check on some settings of my own to be sure, so I'll get back to you with confirmation about what you need in Captivate as far as executing Javascript. My problem is that I use Dreamweaver a lot and so have many controls initiated regarding IIS (Internet Information Server). I need to confirm some behaviors. My own development machine has a lot of services turned on that most machines don't.

I can truthfully say that I always do a final test or dry-run from a server (prior to adding and testing training from an LMS). Scripts are odd things. With Dreamweaver you can "mimic" the execution of some scripts within Dreamweaver but not all. There's a lot of dependencies.

So let me get my ducks in a row and I'll let you know what you need to do next.

The good news is that once you get the routine down, being able to execute Javascripts from Captivate allows sooooo much more flexibility with the program. (And is very handy when using an LMS too.)

TPK
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2006 Oct 07, 2006
Hi TPK,

I don't know if it matters, but I'll paste in the function I use to call my swf file too (I do it this way because of the ActiveX problem).

Then you have everything I use to open the window: the function, the call, and the swf document.write js.

Kim

_______

function fr1() {
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"770\" height=\"580\" id=\"captivate1\">")
document.write(" <param name=\"movie\" value=\"help.swf\">")
document.write(" <param name=\"quality\" value=\"high\">")
document.write(" <param name=\"menu\" value=\"false\">")
document.write(" <param name=\"loop\" value=\"5\">")
document.write(" <embed src=\"help.swf\" width=\"770\" height=\"580\" loop=\"5\" quality=\"high\" pluginspage=\" http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\"></embed>")
document.write("</object>")
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 07, 2006 Oct 07, 2006
Hi Kim,

OK. First things first. I don't think the function fr1() is getting in the way of your other open browser window script. I think we can eliminate that.

You say your javascript call in Captivate looks like this:

Open_Window('help.htm','','width=800,height=750,toolbar=no,menubar=no,scrollbars=no,resizable=yes')

Correct?

Let's confirm a few things:
In Captivate you open the click box properties (I assume this function is tied to a click box). You see:
For the property for On success: (You have entered) "Execute Javascript"
For the property for Execute Javascript: (You have entered) "Open_Window('help.htm','','width=800,height=750,toolbar=no,menubar=no,scrollbars=no,resizable=yes')" (the double quotes at the beginning and end of your statement I have added for emphasis only, they really shouldn't be there.)

If that is correct, slightly change the statement in the "Execute Javascript" field.

Change it to look like this:
javascript:Open_Window('help.htm','','width=800,height=750,toolbar=no,menubar=no,scrollbars=no,resizable=yes')

Make sure you have the word "javascript", then a colon after it, then your full Open_Window with parameters statement. Save, publish and test the html page.

On my own system I have IIS and Data sources enabled, So I think my testing envrionment is different than yours.

Give what I have described above a go and see if you get some type of response. Normally, If you are testing a Captivate animation that has a javascript call in it you should get a warning that "This application is trying to communicate with yada yada yada...". You are saying you get nothing. So my thinking is that your system doesn't understand a "Javascript" call is being made to it.

Let me know what happens after you make that small change.
Good luck,

TPK

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2006 Oct 07, 2006
Hi TPK,

I tried putting in the word javascript, exactly like you said, but still nothing.

So I trolled around on Google, and saw this: http://community.trivantis.com/forum_posts.asp?TID=2062&PN=1&get=last

It seems to say that it can be PC dependent. So maybe I just have an anti-captivate-javascript PC?

I suppose I'll go back to using the Captivate command, even with the horrible toolbars. Unless you have a last idea.

I've really appreciated all your help though.

Kim
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 07, 2006 Oct 07, 2006
LATEST
Hi Kim,

The only thing I can think of that would cause this is if the Browser Preferences have javascript turned off. That would be pretty rare. You can always look in your browser preferences and see if you have it turned off.

Also, I would imagine a "pop-up blocker" might also have the same effect. That would also be easy to check.

If you still have time to persue this you can try e-mailing me direct and I'll see about locating a sample .cp file with embedded script that I have confirmed works. My e-mail address is tim.kern@comcast.net.

Cheers,

TPK
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources