Created
August 26, 2014 09:55
-
-
Save fahied/08999c28a86a62dea5d7 to your computer and use it in GitHub Desktop.
jquery hash or query in UIWebview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set path for the file to load in uiwebview | |
NSString *filePath = [resourceDir stringByAppendingPathComponent:@"index.html"]; | |
// convert to NSURL object, remember not to incoude #tag yet, as fileURLWithPath will replacce jquery # with %23 | |
// and will cause trouble to load your page properly | |
NSURL *fileURL = [NSURL fileURLWithPath:menuPath]; | |
// add hash here | |
fileURL = [NSURL URLWithString:@"#menu" relativeToURL:fileURL]; | |
// in case of query | |
menuURL = [NSURL URLWithString:@"?query" relativeToURL:menuURL]; | |
//load webview | |
[self.webView loadRequest:[NSURLRequest requestWithURL:menuURL]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment