Webhelp embed shows jquery error

This forum is for discussions on the Help & Manual Premium Pack and the Premium Pack Toolbox configuration utility introduced with Premium Pack 3

Moderators: Alexander Halser, Tim Green

Post Reply
Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Webhelp embed shows jquery error

Unread post by Tobias Escher »

Hi!

I've been trying to get WebHelp to embed on my website, but it is showing a jquery missing error:
hmEmbedHelp.js:28 Uncaught ReferenceError: jQuery is not defined
at hmEmbedHelp.js:28
(anonymous) @ hmEmbedHelp.js:28
paleia-development.de/:79 Uncaught SyntaxError: Unexpected token '<'

Given that it shows the correct hmEmbedHelp.js, the code in the head section seems right.

Here's the URL of the embed: https://paleia-development.de/helptest/

The actual help is at: https://paleia-development.de/kthelp/

I'm sure I'm doing something wrong, but I've spent several hours and can't find out what I'm missing...

best

Tobias
Last edited by Tobias Escher on Thu Dec 02, 2021 1:45 pm, edited 1 time in total.
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Webhelp embed shows jquery error

Unread post by Tim Green »

Hi Tobias,

I inspected your page source and the only thing I can see directly is that your reference to jquery.js in your <head> section comes AFTER your reference to the hmEmbedHelp.js script. If you're including jQuery yourself its reference should come first, because the embed script depends on it. However, I also notice that you are referencing the jQuery version in the WebHelp, which you don't need to do. If you aren't using jQuery on your own page you can remove that reference entirely. And if you are, then the reference to it should be before the embed script reference. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Re: Webhelp embed shows jquery error

Unread post by Tobias Escher »

Hi Tim,

great!
I changed the order of scripts and now it complains that WebHelp is trying to load an unsecure script.

jquery-1.8.3.min.js?rwcache=660063148:2 Mixed Content: The page at 'https://paleia-development.de/help/' was loaded over HTTPS, but requested an insecure script 'http://www.paleia-development.de/kthelp ... 8383393009'. This request has been blocked; the content must be served over HTTPS.
send @ jquery-1.8.3.min.js?rwcache=660063148:2

This is crazy... I think I'll just use a normal link :)
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Webhelp embed shows jquery error

Unread post by Tim Green »

Hi Tobias,

This is because one of your sites is on http:// (insecure) and the other is on https:// (secure). Browsers won't allow that on the same page any more. All the components used in a page must come from other pages with the same security status as the page they are being inserted int.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Re: Webhelp embed shows jquery error

Unread post by Tobias Escher »

yes, I understand that, but they aren't. Go to https://paleia-development.de/helptest/
It should all be HTTPS, but nothing opens :(
That error message has vanished, too.
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Webhelp embed shows jquery error

Unread post by Tim Green »

Hi Tobias,

What was happening when you got the error was that the xmessage.js file that is used for cross-page communication was being loaded via an http:// request instead of an https:// request. And that call is specified by the initHmHelp() in the embedding snippet in the body of your page. I can no longer refer to your embed version, but my guess is that you accidentally entered http:// there instead of https://. This is what it should look like:

Code: Select all

initHmHelp("https://www.mydomain.com/myhelp/","index.html");
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Re: Webhelp embed shows jquery error

Unread post by Tobias Escher »

Hi Tim,

as far as I can see, this is the case:

Code: Select all

  initHmHelp("https://paleia-development.de/kthelp/","index.html");
In line 77 at https://paleia-development.de/helptest/
Or am I missing something?

cheers

Tobias
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Webhelp embed shows jquery error

Unread post by Tim Green »

Hi Tobias,

Everything is actually fine on this page now. You just have it set up to not display the embedded help on load, which is the default to speed up loading of the host page. You either need to change it to display by default, or add a button or a link to your page so that the user can click to display and hide it. See here for details:

https://www.it-authoring.com/info/pp4he ... d_web.html

To change the default startup mode, change display: none; to display: block; in these CSS settings in your <head> section:

Code: Select all

<style type="text/css">
div#helpwrapper { 
   display: none; 
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Re: Webhelp embed shows jquery error

Unread post by Tobias Escher »

Hi Tim,

my CSS has
div#helpwrapper {
display: block;
width: 100%;
min-width: 400px;
height: 500px;
background-color: #ffffff;
border: 3px solid #777777;
margin: 1em 0 0 0;
}

iframe#hmhelp {
width: 100%;
height: 100%;
}

Is that wrong?
I just checked and that's how it is on the page, but the help does not load...
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Webhelp embed shows jquery error

Unread post by Tim Green »

Hi Tobias,

This is a little odd (and difficult to debug remotely). The help is actually loading, but it is immediately being hidden, and remotely I can't check where the command to check for this is coming from. I suspect that something in your dynamically-generated page is screwing with the expected sequence of events in the embed script, so that the script is checking the visibility status of the help container before the CSS is actually being applied to it.

Instead, try doing this the other way round. Change the setting in your CSS snippet to display: none; , and add a link to display and hide the help with this code:

Code: Select all

<a class="hmHelpToggle" href="javascript:hmHelp.showHelp()">Show Embedded Help</a>
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Webhelp embed shows jquery error

Unread post by Tim Green »

Hi Tobias,

I've now been able to look into this in more detail and I've found a bug that may be causing the problem in your specific case. In addition to this, the new "Close" button in the top right corner of embedded help needs to be switched off if you are displaying the help as on by default and not including any links for displaying it and hiding it -- otherwise users can close it with the button and then can't open it again without reloading the entire page.

To correct both issues, edit the hmEmbedHelp.js file in your skin as follows:

At line 408, locate this block of code:

Code: Select all

			helpLoaded = true;
			this.firstLoad = false;
			hmHelpVars.currentHelpPage = frameSrc;
			
			if (hmHelpVars.topicChanged) {
				hmToggleHelp("open");
					hmHelpVars.topicChanged = false;
				}  else {
					hmToggleHelp("auto");
				}
And replace it with this:

Code: Select all

			helpLoaded = true;
			hmHelpVars.currentHelpPage = frameSrc;

				if (hmHelpVars.topicChanged || (this.firstLoad && hmHelpVars.hmHelpOpen())) {
						hmToggleHelp("open");
						hmHelpVars.topicChanged = false;
					}  else {
							hmToggleHelp("auto");
					}

		this.firstLoad = false;
Then scroll down to line 597 and locate this block of code:

Code: Select all

					hmHelp = new hmH(path, topic, callback);
					if (hmHelp.startupOn) {
						hmHelp.showHelp();
						}
and replace it with this:

Code: Select all

					hmHelp = new hmH(path, topic, callback);
					if (hmHelp.startupOn) {
						hmHelp.showHelp();
						if ($(".hmHelpToggle").length < 1) {
							$("div#helpcloser").hide();
							}
						}
That should fix both issues. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Tobias Escher
Posts: 202
Joined: Mon Dec 28, 2015 7:32 pm

Re: Webhelp embed shows jquery error

Unread post by Tobias Escher »

Hi Tim,

thanks so much!
It works great! I had a Death March at work this week, so only now finally was able to try it out.
I think there might be one more issue. When clicking the Hamburger menu - "Zoom out" in any topic, a new page opens which shows just the topic header, nothing else.
I have actually disabled the topic header, so this seems like a bug.

best

Tobias
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Webhelp embed shows jquery error

Unread post by Tim Green »

Hi Tobias,
Tobias Escher wrote: Sat Dec 11, 2021 12:53 pm I think there might be one more issue. When clicking the Hamburger menu - "Zoom out" in any topic, a new page opens which shows just the topic header, nothing else.

Thanks for reporting this -- I'm currently readying an update so it's excellent to have this kind of feedback in time. I'll look into it and see if I can reproduce it.

I have actually disabled the topic header, so this seems like a bug.
The V3 and V4 skins can't not have topic headers and one is generated automatically if you turn it off, so that shouldn't have an effect. I'll check it out. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Tim Green
Site Admin
Posts: 23155
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Webhelp embed shows jquery error

Unread post by Tim Green »

Hi Tobias,

I can't reproduce your error with zooming the embedded help out and back in. Please mail me a small demo project along with the edited copy of the skin you are using at support AT ec-software.com (replace the AT with @) and I'll see if I can reproduce it there. Since the skin contains scripts that would be blocked by the mail server, please pack everything in a zip and just send a download link. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply