WebHelp redirection and fragment in URL

<oXygen/> general issues.
HomeGoods
Posts: 87

WebHelp redirection and fragment in URL

Wed Jun 08, 2016 6:28 pm

Hi,

Are there any ways to suppress the redirection in WebHelp?

For example, open this URL: https://www.oxygenxml.com/doc/versions/ ... r1m_kfs_zp

Case 1: If JavaScript is disabled on the client web browser, the pages is opened and scrolled to the middle of the page where "#edit-topics__ul_r1m_kfs_zp" is assigned.
Case 2: If JavaScript is enabled on the client (as usual), you are redirect to another URL. This time, the page is not scrolled. The original fragment "#edit-topics__ul_r1m_kfs_zp" is lost.

Sometimes I need the behavior of Case 1 even when JavaScript is enabled, particularly when I have to ask someone to look at a specific portion of the page.
If I could give a certain URL (something like .../eppo-edit-topics.html?redirect=no#edit-topics__ul_r1m_kfs_zp) and if it behaved in the way of Case 1, it would help very much.
HomeGoods
Posts: 87

Re: WebHelp redirection and fragment in URL

Wed Jun 08, 2016 6:33 pm

Another more specific use case is WebHelp with Feedback.
Its notification email contains a URL like .../foo.html#10 - but it doesn't work.
bogdan_cercelaru
Posts: 205

Re: WebHelp redirection and fragment in URL

Thu Jun 09, 2016 3:16 pm

Hello,

HomeGoods wrote:Are there any ways to suppress the redirection in WebHelp?
If you want to completely disable the redirect, then you should edit the [DITA_OT_DIR]/plugins/com.oxygenxml.webhelp/oxygen-webhelp/resources/js/webhelp_topic.js file and remove or comment the following line:

Code: Select all

window.location.href=getPath(location.pathname);
HomeGoods wrote:Case 2: If JavaScript is enabled on the client (as usual), you are redirect to another URL. This time, the page is not scrolled. The original fragment "#edit-topics__ul_r1m_kfs_zp" is lost.
This shouldn't happen. To resolve this, you should edit the [DITA_OT_DIR]/plugins/com.oxygenxml.webhelp/oxygen-webhelp/resources/skins/desktop/toc_driver.js and change the following line

Code: Select all

newLink = newLink + "#" + location.search.substring(pos + wh.directory.length)

with:

Code: Select all

newLink = newLink + "#" + location.search.substring(pos + wh.directory.length) + location.hash;


Regards,
Bogdan
Bogdan Cercelaru
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
HomeGoods
Posts: 87

Re: WebHelp redirection and fragment in URL

Thu Jun 09, 2016 6:28 pm

bogdan_cercelaru wrote:

Code: Select all

newLink = newLink + "#" + location.search.substring(pos + wh.directory.length) + location.hash;

Thanks for the fix.
For me to get it work, two more changes were necessary.

  1. [DITA_OT_DIR]/plugins/com.oxygenxml.webhelp/oxygen-webhelp/resources/js/webhelp_topic.js
    Replace

    Code: Select all

    window.location.href=getPath(location.pathname);
    with

    Code: Select all

    window.location.href=getPath(location.pathname) + location.hash;
    because without it, toc_driver.js didn't receive the fragment in the first place.
  2. [DITA_OT_DIR]/plugins/com.oxygenxml.webhelp/oxygen-webhelp/resources/skins/desktop/toc_driver.js
    Replace

    Code: Select all

    newLink = newLink + "#" + location.search.substring(pos + wh.directory.length -1);
    with

    Code: Select all

    newLink = newLink + "#" + location.search.substring(pos + wh.directory.length -1) + location.hash;
    because I'm testing locally.

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 2 guests