This question about : Answered

TOC does not work in Safari

Copied from Tasks/Item14034

I usually use Chrome, but today I was testing a problem in Safari. When I was putting together a page that illustrated that problem (, I tripped over a TOC issue in Foswiki.

When I click on TOC entries in Safari, the page blinks and repaints, but does not scroll to the appropriate location. I looked at the underlying HTML and, instead of the expected <a name=... tages, I saw id attributes:

<div id="foswikiTOC" class="foswikiToc"> <ul>
<li> <a href="#Screen_shot_45_Chrome"> Screen shot - Chrome </a>
</li> <li> <a href="#Screen_Shot_45_Safari"> Screen Shot - Safari </a>
</li> <li> <a href="#Screen_Shot_45_Zapped"> Screen Shot - Zapped </a>
<h2 id="Screen_shot_45_Chrome">  Screen shot - Chrome  </h2>
    --- content ---
<h2 id="Screen_Shot_45_Safari">  Screen Shot - Safari </h2>
    --- content ---
<h2 id="Screen_Shot_45_Zapped">  Screen Shot - Zapped </h2>
    --- content ---

-- VickiBrown - 30 Mar 2016

Seems to be a configuration mismatch of your server: your foswiki always generates long urls ( whereas the web-server immediately redirects to short urls. See also the value of the <base ...> element. Any click on a TOC link thus refreshes all of the page ... instead of just scrolling down ... because the website's url does not match to the emitted urls.

Btw <a name> is invalid in HTML5. See 5.6.9 Navigating to a fragment identifier. I am pretty sure once you fixed your short urls will Safari be just fine (fingers crossed). Please reopen this bug report when that is not the case including info about the version of Safari you are using.

-- MichaelDaum - 30 Mar 2016

'>> Seems to be a configuration mismatch of your server:
'>> I am pretty sure once you fixed your short urls

OK, given that I used the Foswiki Apache config generator.... how do I "correct" this?

  #  Rewriting is required for Short URLs, and Attachment redirecting to viewfile
  RewriteEngine    on
  #RewriteLog "/var/log/apache/rewrite.log"
  #RewriteLogLevel 0

  # short urls
  Alias / "/WWW/foswiki2/bin/view/"
  RewriteRule ^/+bin/+view/+(.*) /$1 [L,NE,R]
  RewriteRule ^/+bin/+view$ / [L,NE,R]

-- VickiBrown - 30 Mar 2016

" See also the value of the <base ...> element."

I don;t understand. What does this have to do with me? I don't control that.

-- VickiBrown - 30 Mar 2016

If you are redirecting for anchors, then your {ScriptUrlPaths}{view} is probably wrong. Make sure it's "empy". Script Url Path for View: {ScriptUrlPaths}{view} has a "verify" button. Note that it will prompt for a password, you should just "confirm" it. It should report something like:
Tracing access to, {ScriptUrlPaths}{view} = '' Server received the expected path: (empty) 

The <base ...> element is actually set by this configuration option, and by the {DefaultUrlHost}

-- GeorgeClark - 31 Mar 2016

Vicki, I just tried to explain.

-- MichaelDaum - 31 Mar 2016

QuestionForm edit

Extension TocPlugin
Version Foswiki 2.0.3
Status Answered
Related Topics
Topic revision: r3 - 31 Mar 2016, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy