• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using an anchor in NSURL file url
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using an anchor in NSURL file url


  • Subject: Re: Using an anchor in NSURL file url
  • From: Fritz Anderson <email@hidden>
  • Date: Tue, 26 Jan 2016 15:23:08 -0600

On 21 Jan 2016, at 4:35 PM, 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 #.
>
> I tried [NSURL URLWithString: anchorname relativeToURL: baseURL] but this produces a url with the form
>
> #anchorname--[path]/filename.html
>
> and that doesn't work (opens the file, but ignores the anchor).
>
> Is there any way to use an anchor in a file url for WKWebView?

Have a look at -[NSString stringByAddingPercentEncodingWithAllowedCharacters:]. Construct a character set that permits #, then build the NSURL from the string. (Or does NSURLRequest “improve” the URL it gets?)

	— F


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Using an anchor in NSURL file url (From: Jeff Evans <email@hidden>)

  • Prev by Date: Re: Can a command-line tool have a bundle ID?
  • Next by Date: Re: Using Configurations to build a single target for multiple platforms?
  • Previous by thread: Using an anchor in NSURL file url
  • Next by thread: Address Sanitizer and out-of-project libraries
  • Index(es):
    • Date
    • Thread