Re: Using an anchor in NSURL file url
Re: Using an anchor in NSURL file url
- Subject: Re: Using an anchor in NSURL file url
- From: Quincey Morris <email@hidden>
- Date: Thu, 21 Jan 2016 17:32:28 -0800
- Feedback-id: 167118m:167118agrif8a:167118s6scXNCOpz:SMTPCORP
On Jan 21, 2016, at 17:17 , Jeff Evans <email@hidden> wrote:
>
> In OSX I'm using an NSURLRequest to load a file url in WKWebView. Works fine unless I try to add an anchor to the path, for example,
>
> [path]/filename.html#anchorname
>
> The problem appears to be that the # gets escaped to #.
Can you show what APIs you’re using for this? Are you appending the anchor to an existing string or URL? Are you explicitly creating a file URL, or a generic URL?
Looking at NSURL documentation, it looks like NSURL recognizes the anchor as a piece called “fragment”.
> I tried [NSURL URLWithString: anchorname relativeToURL: baseURL] but this produces a url with the form
This doesn’t seem likely to work. In this API, the first parameter is assumed to *be* a URL, albeit in relative form, not a URL piece, which is what you have.
_______________________________________________
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