title: How to trigger href link programmatically using Objective C
body: <p>What I need to do is when I click a button or do a certain action, I want to have the webview transferred as if I have clicked on an href link the function should take the href id to know which link to go to. </p>
  
  <p>Here's what I have tried so far:</p>
  
  <pre><code>      [WebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"window.location.hash='%@'",footNoteNum]];
      float offsetX = [[WebView stringByEvaluatingJavaScriptFromString:@"window.pageXOffset"] floatValue];
      NSLog(@"offsetX %f", offsetX);
      int page = ceil(offsetX/748);
  
      page++;
      NSLog(@"page %i", page);
      [self scrollToPage:page];
  </code></pre>
  
  <p>But when webview is greater then 25 pages it starts giving wrong numbers for offsetX.</p>
  
  <p>So I thought if I can do just like an href link that can be clicked dynamically so when I use the scrollbar it would take me to the right position in the webview. </p>