Javascript and Page Layouts

This forum is for all Flare issues not related to any of the other categories.
Post Reply
oceanclub
Sr. Propeller Head
Posts: 277
Joined: Thu Oct 10, 2013 4:45 am
Location: Dublin

Javascript and Page Layouts

Post by oceanclub »

Hi all,

I'm a newbie to using JavaScript so bear with me.

I have some JavaScript which I want to use to:
* Take the alt attribute for each image
* Automatically add it as a caption under the image, wrapped in a <p> tag with a figurecount attribute.

I've put this JavaScript into a file caption.js under Content/Scripts

I want to use this JavaScript in both printed PDF targets and HTML5 sidenav targets, in all topics, so

However, we use page layouts, not master pages. When I look at the official Flare documentation for JavaScript Tutorial at, I don't see any mention of using JavaScript in page layouts:

https://help.madcapsoftware.com/flare20 ... torial.htm

Does anyone know how I should approach this?

Regards,

Paul
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Javascript and Page Layouts

Post by NorthEast »

I don't think Javascript is supported in a Flare-generated PDF.

The help isn't particularly clear on that, but PDF is not listed in the "outputs supported" in the topic about inserting scripts.
https://help.madcapsoftware.com/flare20 ... Topics.htm
oceanclub
Sr. Propeller Head
Posts: 277
Joined: Thu Oct 10, 2013 4:45 am
Location: Dublin

Re: Javascript and Page Layouts

Post by oceanclub »

Hi Dave

Oh yeah, I understand JavaScript won't run on a PDF, but I thought you could generate hardcoded output via Javascript that would end up in both the PDF and the online help (in this case, a hardcoded caption, generated from the "alt" attribute of the related graphic. Disappointed if that can't be done!

Regards,

Paul
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Javascript and Page Layouts

Post by NorthEast »

No, Javascript is not run at build time in Flare. Javascript is run by the end application that's displaying your content - so if you produce HTML5 output, the Javascript is being run by the browser when you open the page.

If you have a look on Google, it seems Javascript can be run in a PDF (Adobe has an API for Acrobat), but I don't think Flare supports including Javascript in PDFs - or at least it's not documented in the help. So you may want to ask MadCap to get a definitive answer.
Also bear in mind that PDFs aren't HTML, so if you're wirintg Javascript to manipulate HTML, then I'm not sure if that's going to work in a PDF. That's just a guess on my part, I have no experience of using Javascript in PDFs.
Post Reply