Re: UIWebview: scrolling vs anchors - followup
Re: UIWebview: scrolling vs anchors - followup
- Subject: Re: UIWebview: scrolling vs anchors - followup
- From: John Joyce <email@hidden>
- Date: Wed, 22 Dec 2010 08:36:19 -0600
On Dec 21, 2010, at 8:27 PM, Donald Hall wrote:
> On December 20 I wrote:
>
> -------------------------
> I have a UIWebview in my app that I want to use to load an HTML document containing anchors so that I can jump around the document by tapping on the links to the various anchors. (e.g. a link at the bottom of the page to jump to the top of the page)
>
> I have the links and anchors working fine, except that for example when I am at the bottom of the page and tap on the link to jump to the top of the page, then scroll down from the top to the bottom, then tap the link to go to the top again, nothing happens. It's as if the webview thinks it is still at the top of the page.
>
> Is there any way to get the webview to realize that the top of the page is no longer visible after scrolling? I tested this on my Mac with Safari, and scrolling does not affect the action of the link and anchor there.
>
> Thanks for any help. I have spent several hours searching with no luck.
>
> Don
> -------------------------
> I thought I should add a bit more information following some further investigation. I hope it might help someone else out in the future.
>
> My idea was to include a simple help document with my app. By using HTML I could have a table of contents at the top, and a user could select a topic by tapping on it to go to an anchor further down the page. At the end of the topic would be another link to return to the top of the page. My investigations here show that if the user scrolls to the top instead of using the link, then the original link to the topic would no longer work.
>
> It appears that once an anchor is jumped to you cannot jump to that anchor again until you jump to a different anchor. This resets something. Any href link to the anchor highlights normally, but nothing happens. No web view delegate methods are called, as they are the first time the link is clicked on. Here is my test file:
>
> <!DOCTYPE html>
> <html lang="en">
> <a name="top"></a>
> <a href="#bottom" rel="self">Go to bottom.</a><br>
> <a href="#bottom" rel="self">Go to bottom.</a><br>
> Line 1<br>
> Line 2<br>
> ... enough lines to extend below the screen.
> Line 3<br>
> <a name="bottom"></a>This is it.<br>
> <a href="#top" rel="self">Go to top.</a></html>
>
> If I click on the first "Go to bottom." link I jump to the bottom as expected. If I scroll back up to the top and click on either "Go to bottom." link nothing happens. If I then scroll back to the bottom and click on "Go to top" I jump to the top, and either of the "Go to bottom" links works to get me to the bottom again.
>
> Unless anyone can tell me I have missed something, I think I will file a bug report on this.
>
> Thanks,
>
> Don
>
> --
> Donald S. Hall, Ph.D.
> Apps & More Software Design, Inc.
> email@hidden
> http://www.appsandmore.com
> _______________________________________________
>
>
Hi Don,
Please file a bug with bugreporter.apple.com
It would be god to attach any files/simple test app to show the issue.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden