Not an issue I've come across but also not an area I've explored... A quick
search through the mailing list did suggest one possible approach as below,
but I've no idea how viable it might be!

public Page extends WebPage implements IHeadContributor {
    ........
    @Override
    public void renderHead(IHeaderResponse r) {
           r.renderOnLoadJavascript("location.hash='YOUR-ANCHOR'");
    }
}

/Gwyn

On Mon, Jun 16, 2008 at 10:33 PM, Michael Mehrle <[EMAIL PROTECTED]>
wrote:

> Yes - they do match - you're right, always check the basics first. The
> problem is that even if I bookmark the anchored page (with the anchor
> tagged on), and load the page it won't jump there. So, I don't think
> it's the way I create the anchor (because the URL looks correct) - it's
> all the other wicket AJAX stuff that somehow prevents the anchor from
> being recognized on page load. Is there a work around for this?
>
> Thanks,
>
> Michael
>
> -----Original Message-----
> From: Gwyn Evans [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 16, 2008 1:02 PM
> To: users@wicket.apache.org
> Subject: Re: Browser not jumping to Wicket Anchor
>
> Just looking at the HTML, do the anchor & the destination match
> correctly?
> Is the destination url just a normal page, or a form of some sort?
>
> /Gwyn
>
> On Mon, Jun 16, 2008 at 6:58 PM, Michael Mehrle <[EMAIL PROTECTED]>
> wrote:
>
> > I created an Link to another page's anchor similar to the code shown
> > below. The anchor actually gets tagged on to the bookmarkable URL.
> > However, for some reason the browser does not jump to my anchor.
> >
> >
> >
> > Not sure what's going on - is there a particular way I have to create
> an
> > anchor in Wicket so that the URL causes the browser to scroll further
> > down in the page?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Michael
> >
> >
> >
> >
> >
> > public class AnchoredBookmarkablePageLink extends BookmarkablePageLink
> {
> >
> >
> >
> >  private static final long serialVersionUID = 1L;
> >
> >
> >
> >  private IModel stringAnchor;
> >
> >
> >
> >  public AnchoredBookmarkablePageLink(String id, Class pageClass,
> IModel
> >
> >
> > anchor) {
> >
> >    super(id, pageClass);
> >
> >    this.stringAnchor = anchor;
> >
> >  }
> >
> >
> >
> >  public AnchoredBookmarkablePageLink(String id, Class pageClass,
> >
> > PageParameters params, IModel anchor) {
> >
> >    super(id, pageClass, params);
> >
> >    this.stringAnchor = anchor;
> >
> >  }
> >
> >
> >
> >  @Override
> >
> >  protected CharSequence appendAnchor(ComponentTag tag, CharSequence
> > url) {
> >
> >    url = url + "#" + stringAnchor.getObject().toString();
> >
> >    return url;
> >
> >  }
> >
> >
> >
> > }
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to