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

How to retain user choice in a chm? Cookies don't work...

Enthusiast ,
Aug 16, 2016 Aug 16, 2016

Copy link to clipboard

Copied

I have the latest RH 2015 (12.0.3.428) on a Windows 64 bit machine.

Our primary output is CHM.

We're working on dynamic documentation themes. We want to allow our users to choose between Light and Dark themed CSS files. I've modified our header in the .htt to load in the correct css file whenever they click on a Light or Dark link, like this:

Light theme:

Dark theme:

Pretty nifty huh? Yeah, that part works great. (I have jQuery under the hood pulling in the right css filename.)

But it's not persistent, and is, frankly, useless without persistence. Any time I change to a new topic or reload the chm, the chosen css state goes away. So I thought Cookies should do the trick. And they do work... in normal chm-less topics. But they don't work in a chm. I cannot read or set cookie information in a chm (even though the same .htm outside of a chm works just fine). The minute I try to bring the file into a chm, and use it to set cookies, it doesn't work.

So, my question is this:

Has anyone come up with a different way of getting, storing, and retaining user-persistent information for a chm, even after you close down a chm or switch to a new topic?

Views

735

Translate

Translate

Report

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
Community Expert ,
Aug 16, 2016 Aug 16, 2016

Copy link to clipboard

Copied

Can you set the cookie in the folder the chm is located in somehow? I feel like people were doing something like that years ago, but I can't remember the details.

Oo, have a look on this page there's a section about persistence:

HH Tips & Tricks - Helpware Wiki - KB

Votes

Translate

Translate

Report

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
Community Expert ,
Aug 17, 2016 Aug 17, 2016

Copy link to clipboard

Copied

If the above doesn't help, could you not create two CHM outputs and set up something to call the chosen file?


See www.grainge.org for RoboHelp and Authoring information

@petergrainge

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

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
Enthusiast ,
Aug 17, 2016 Aug 17, 2016

Copy link to clipboard

Copied

Thanks Amebr. I did find this info yesterday (quoted on other sites--but never found this direct page. Thanks). I'm interested in Scott Boggan's demo, but those links are, I believe, from 2002 or earlier. Most are dead.

I did try messing around with having a file outside of the chm handle the cookies and calling that file with iframe, as directed. I couldn't get it to work. The chm could never find the file specified in the iframe. But maybe I was doing something wrong. I'll look some more into it. It's likely I missed something.

Thanks Peter. Having different versions of the chm is not an option for us. We're trying to cut down on disk space in our downloads. Duplicating all our chms across all 16 languages will cause a spike in an undesired direction.

Votes

Translate

Translate

Report

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
Enthusiast ,
Aug 17, 2016 Aug 17, 2016

Copy link to clipboard

Copied

I spent another 3 hours on this today fiddling with iframes, trying to get a chm to recognize an .htm in the same directory. (One's patience begins to wear thin.)

The idea, from the link that Amebr posted (HH Tips & Tricks - Helpware Wiki - KB ), is to have an .htm outside of the chm handle the getting and setting of cookies. An iframe tag pulls that .htm into each chm topic, thereby allowing cookies to work, in a round-about way, inside of a chm.

From my tests, however, I'm becoming convinced that chms today cannot handle this kind of workaround. Perhaps someone else can confirm whether it's possible to do what I'm attempting? To pull in content from an .htm in the same dir as the chm, but that is not part of the chm project?

I feel like I'm pulling a chm kicking and screaming to places it was not meant to go.

Votes

Translate

Translate

Report

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 ,
Aug 17, 2016 Aug 17, 2016

Copy link to clipboard

Copied

Mmmmm yeah. Good luck with that!

Pulling from distant memory here. I believe there has always been an issue where CHM files have "issues" dealing with files outside the CHM itself. Basically it involves figuring out the path leading to the file. Depending on how the CHM was opened, it may actually misunderstand what that path is.

I'm not sure if you have tried this, but the stuff at the link below allows working past that:

Example: Link to a File Outside of Your Help System (Windows)

If that's what you tried, I'm at a loss.

Cheers... Rick

Votes

Translate

Translate

Report

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
Enthusiast ,
Aug 18, 2016 Aug 18, 2016

Copy link to clipboard

Copied

LATEST

Thanks for the response Rick. This isn't what I was doing, but maybe it'll lead me to a breakthrough.


I'll take a look at that link you provided. I do have my javascript working and it can find out where the chm is located within the file structure. I just need to be able to somehow get it to talk to the file sitting right next to it in the directory structure.

Regards,

Jared

Votes

Translate

Translate

Report

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
RoboHelp Documentation
Download Adobe RoboHelp