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

JavaScript to open new browser window

Guest
May 02, 2007 May 02, 2007
I have an intranet page from which users can select various Captivate 2 movies. When they select the link I use a simple JavaScript function to open an appropriately sized window to run the movie in, as they are of various sizes and some so large I need to do away with toolbars and the like.

To save the users having to return to the Intranet page to open another movie I want to offer them a button at the end of a movie which would have the same effect - open a new browser window appropriately sized for the particular movie they choose.

This should be easy: create a button, choose Execute JavaScript and put the script in the box. Only it doesn't work.
Scouring the forums I found a few potential answers, of which the most promising seemed to be to put the function in the standard.js file that Captivate 2 creates and then call the function from the Execute JavaScript dialogue. I also tried putting the function into the HTML that is created when the Captivate is published. Also didn't work.

I've tried various permutations in the Execute JavaScript dialogue too. Do I or do I not need to preface the line with javascript: or javascript:function? I tried all options without success.

It would help my nerves if every time I republish a new attempt it didn't overwrite standard.js!

If I could solve this I could also probably solve my other requirement to close the browser window when the movie stops - I gave up on that last year as not being worth the effort.

Any help will be very gratefully received.
WizardOfWellingboro
784
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 ,
May 02, 2007 May 02, 2007
Hi WizardOfWellingboro and welcome to our community

If you open Windows Explorer and navigate to the following location:

C:\Program Files\Adobe\Adobe Captivate 2\Templates\Publish
(Assuming you installed Captivate using the default location)

You should find the "seed" standard.js file that you may modify. Once you do this, your tweaks should be present in any Captivate you produce. Would that help?

Cheers... Rick
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
Guest
May 02, 2007 May 02, 2007
Ah, yes, that's extremely useful. Thank you. But can you go a step further and tell me what I ought to be putting in the Execute JavaScript dialogue?
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 ,
May 02, 2007 May 02, 2007
Hi again

Hmmm, I've dealt with it a bit here and there. I do dabble in JavaScript a tad and know just enough to get myself into and out of most trouble I normally manage to create.

Anyhoo, I just tested by creating a button programmed to pop an alert when clicked. All I inserted into the window was:

alert ("This is a Javascript Alert") and sure enough it worked. So I'm guessing that you don't need to preface things with JavaScript: first.

Keep in mind that I don't believe you will have any success if you run as a .EXE or run the .SWF directly. It only seems to work if I'm running as a .SWF being presented from inside its corresponding HTML page. If I run the .SWF directly, the button produces a blank browser window.

Cheers... Rick
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
Guest
May 02, 2007 May 02, 2007
I am close to despair here! I create a button, I go to it's properties, I select Execute JavaScript and in the dialogue that opens when I click the button with 3 dots I type alert("watch out"). I save and publish the file and run the movie - get to the button and it clicks but NOTHING HAPPENS.

Tried turning Continue playing project on and off, I've got Current selected as the alert box will pop up in the current window. I tried different formats, such as window.alert("watch out") and I tried putting javascript: in front of the line, which I've seen done elsewhere. No result no matter what I do.

It's not that JavaScript is turned off in my browser - the functions I have created to run inside my HTML work fine.
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 ,
May 02, 2007 May 02, 2007
Hi again

Okay, one more time I ask, how exactly are you running the output? For that matter, what browser are you using?

Are you using the HTML page that Captivate creates? Because in my testing, if I simply ran the .SWF without the corresponding HTML page, it failed for me. I would also expect it to fail if I used the .EXE output. In other words, the only way I saw it work was when creating .SWF output and displaying that output using the HTML page designed to run the movie. The thing is, I'm guessing you are, since you have other functions. So to be honest, I'm a bit stumped. Maybe someone else has something to offer that I'm missing. Wouldn't be the first time and I'm the first to admit that I don't know it all.

Cheers... Rick
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
Guest
May 02, 2007 May 02, 2007
Thanks Rick - it's IE6, the JavaScript I use in my pages normally works fine, I tried running it from the page Captivate creates, and from my own (which calls the Captivate-created page anyway, in a specified window). I am now asking our software deployment guys if they've disabled something!

The more one learns the more one discovers one doesn't know! I appreciate your help.

Wizard
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 ,
May 02, 2007 May 02, 2007
Hi again

Loved your statement: The more one learns the more one discovers one doesn't know!

A former co-worker once shared this with me. It was shared with him by a former college professor. It's quite amazing when you think about it. I refer to it as The Circle of Knowledge

Draw a small circle on a piece of paper. Everything that fits inside the circle represents your total knowledge of any given field. The edge of the circle represents everything you are currently aware of that you don't know about it.

Now let's assume you learn a vast amount about the subject. Just look at how large your circle has become! But look at the other effect. Look at how much more you are currently aware of that you don't know about it.

If you would like to ship something my way, I'll be happy to see if it runs without issue on my PC or if I see what you are seeing. If not, that's cool too. Just thought I'd toss out the offer. rstone75 (at) kc (dot) rr (dot) com. Address intentionally altered in order to obfuscate scammers.

Cheers... Rick
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
Guest
May 02, 2007 May 02, 2007
LATEST
Thanks for the circle idea - I can use that.

If the packaging people in my firm say they've not stripped out any functionality, I'll take your offer up. I should hear tomorrow.
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