Redirect user using NetworkExtension framework

1.3k views Asked by At

I have an application that uses NEFilterProvider API to filter urls (allows/blocks browsing). ControlProvider and DataProvider extensions created.

So for this point I can block/allow certain urls. I wonder if there is a way to implement redirection to custom url using NetworkExtension ?

1

There are 1 answers

0
serhii.syrotynin On BEST ANSWER

According to NEFilterDataProvider:

If the Filter Data Provider chooses to block the web page, then a special “block” page is displayed in the WebKit browser object informing the user that their attempt to access the content was blocked. The Filter Data Provider can choose to add a link to this block page, giving the user the option of requesting access to the content.

There is no other way to redirect user besides a link from "block" page. Neither url nor page content could be changed using NEFilterProvider API.

The best solution for redirection would be a VPN connection. You can find example here.