Javascript in a Flare project?

This forum is for all Flare issues not related to any of the other categories.
Post Reply
wbrisett
Sr. Propeller Head
Posts: 216
Joined: Mon Oct 05, 2009 3:29 pm
Location: Austin, TX

Javascript in a Flare project?

Post 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
Andrew
Propellus Maximus
Posts: 1237
Joined: Fri Feb 10, 2006 5:37 am

Re: Javascript in a Flare project?

Post 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.
Flare v6.1 | Capture 4.0.0
wbrisett
Sr. Propeller Head
Posts: 216
Joined: Mon Oct 05, 2009 3:29 pm
Location: Austin, TX

Re: Javascript in a Flare project?

Post 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!
Andrew
Propellus Maximus
Posts: 1237
Joined: Fri Feb 10, 2006 5:37 am

Re: Javascript in a Flare project?

Post 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).
Flare v6.1 | Capture 4.0.0
Craig.Prichard
Propeller Head
Posts: 62
Joined: Sat Dec 10, 2005 8:06 pm
Location: Calgary, AB Canada

Re: Javascript in a Flare project?

Post by Craig.Prichard »

Does anyone have some sample javascript code for reading a cookie when a WebHelp page loads?
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Javascript in a Flare project?

Post 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.
Craig.Prichard
Propeller Head
Posts: 62
Joined: Sat Dec 10, 2005 8:06 pm
Location: Calgary, AB Canada

Re: Javascript in a Flare project?

Post by Craig.Prichard »

Unfortunately, PHP is not an option, only javascript (or vbscript).
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Javascript in a Flare project?

Post 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.
Craig.Prichard
Propeller Head
Posts: 62
Joined: Sat Dec 10, 2005 8:06 pm
Location: Calgary, AB Canada

Re: Javascript in a Flare project?

Post 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.
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: Javascript in a Flare project?

Post by RamonS »

Ah, red tape, not a technical reason. Well, then good luck!
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Javascript in a Flare project?

Post 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.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Post Reply