Page 1 of 1

Javascript in a Flare project?

Posted: Thu May 06, 2010 9:19 am
by wbrisett
Talking with one of the engineer's on project I'm working on, we came up with the great idea (OK, it was 4:30 AM, so maybe that has something to do with it). However, I wanted to toss this out and see if anybody had every done anything like this, or could think of why something like this wouldn't work...

We have a huge, hmmm... maybe ginormous is a better word for it ... Register Programming Guide that contains 20,000+ registers. I have a written a custom script that extracts the registers from the output generated by the hardware design software. I have turned each register into it's own DITA topic, and then I build a DITAMAP that get's placed into Flare and we build a webhelp project. Now, for the interesting part we cooked up this morning. We're thinking of adding a custom button either to the webhelp interface, or on each page, which would run a javascript and generate a 'c' header file for the register displayed on the screen. We provide these in the software kit, but there are plenty of times when customers either destroy or need to have a clean/new version of the header file.

Has anybody added any custom scripts to their documentation projects? If so, did you have any issues implementing them?

Wayne

Re: Javascript in a Flare project?

Posted: Fri May 07, 2010 5:39 am
by Andrew
I've added JavaScript to my Flare WebHelp projects with little difficulty. If all you are doing is interacting with existing elements on the page, you're usually fine. When you get into trouble is when you try to do things that are likely to run up against browser security policies.

Re: Javascript in a Flare project?

Posted: Fri May 07, 2010 7:07 am
by wbrisett
Andrew wrote: When you get into trouble is when you try to do things that are likely to run up against browser security policies.
And in fact that is very likely since it would need to write files out to the hard drive, which can be a big 'no-no' depending on the security policy. I hadn't even thought about that... Thanks!

Re: Javascript in a Flare project?

Posted: Fri May 07, 2010 7:37 am
by Andrew
Yeah, that is going to cause problems. If it's something you can do with cookies instead, that might be one option, but otherwise, you'll have to get your customers to change their security policy (and even then, they may still get prompts).

Re: Javascript in a Flare project?

Posted: Tue Mar 15, 2011 3:08 pm
by Craig.Prichard
Does anyone have some sample javascript code for reading a cookie when a WebHelp page loads?

Re: Javascript in a Flare project?

Posted: Tue Mar 15, 2011 5:51 pm
by RamonS
Since it is WebHelp, use a PHP script. PHP has excellent cookie handling and even covers the cases where browsers reject cookies. The parameters then get passed through the URL calls.

Re: Javascript in a Flare project?

Posted: Tue Mar 15, 2011 8:56 pm
by Craig.Prichard
Unfortunately, PHP is not an option, only javascript (or vbscript).

Re: Javascript in a Flare project?

Posted: Wed Mar 16, 2011 4:20 am
by RamonS
Any reason why PHP is not an option? PHP binaries are available for almost any web server out there. Besides that, PHP is server side scripting, JavaScript is not. If the client selectively decides to not run your special script (which is quite easy to do) you have nothing left. JavaScript is OK as long as you don't have to count on it. The only choice then is to cut the client off right at the start with a "You cannot view this page without JavaScript enabled" message. Of course, you can use ASP or JSP or something else that is server side.

Re: Javascript in a Flare project?

Posted: Wed Mar 16, 2011 5:58 am
by Craig.Prichard
PHP is not an option because my WebHelp is being deployed within the City of Calgary intranet, tightly-controlled by IT. I had to jump through hoops to get authorization for the javascript already present in Flare's WebHelp.

Re: Javascript in a Flare project?

Posted: Wed Mar 16, 2011 9:33 am
by RamonS
Ah, red tape, not a technical reason. Well, then good luck!

Re: Javascript in a Flare project?

Posted: Wed Mar 16, 2011 1:43 pm
by LTinker68
Craig.Prichard wrote:Does anyone have some sample javascript code for reading a cookie when a WebHelp page loads?
One source I like to use for JavaScripts is http://javascript.internet.com/ and they have a whole section on cookies, although I've never used any of the scripts in that section so I can't speak to their use.