Return to Snippet

Revision: 2872
at April 30, 2007 07:09 by iloveitaly


Initial Code
- (void) jumpToAnchor:(NSString *)anchor {
	// http://lists.apple.com/archives/Webcore-dev/2003/Jul/msg00004.html
	[oWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"var anchor = document.anchors[\"%@\"];window.scrollTo(anchor.offsetLeft, anchor.offsetTop);", anchor]];
}

Initial URL
http://mabblog.com/

Initial Description
There is no native Cocoa way to do this, and this method was not advertised on the net much.
This is the only way to jump to a named anchor programatically.

Initial Title
Jump To HTML Anchor WebView

Initial Tags

                                

Initial Language
Objective C