Facebook.com and the iOS7 Captive Portal Detection

前端 未结 3 1829
粉色の甜心
粉色の甜心 2021-02-04 21:21

I created a router that connects to facebook to get some info before a user may access the internet.

First they connect, get the Captive Portal Page and then continue to

3条回答
  •  天命终不由人
    2021-02-04 21:26

    I found my solution to my problem. (a while ago, but I found this post again)

    First I found out, iOS makes 3 calls, first to check, second to get the page that needs to be displayed, third to check again after the pageload. Then I discovered, for every POST or GET action made by the page, regarding of the source page was refreshed, iOS checks for an active internet connection. Since the facebook api makes a lot of calls, the browser starts stalling(possible in combination with QoS on my router) and freezes the page.

    My Solution:

    Since I am in control of the DNS records of the Router I use, I redirected all domains towards my own server.

    First I saved the check request, this to later identify the user when he comes back for the 3th request.

    When the second request comes I just display an info window that every thing is right, and the user has to click the "Done" button.

    The page is loaded, so iOS checks again, but i recognize the user so I display the OK-code Apple also displays. The "Done" button us show, and the user has "internet", according to iOS..

    On the page that I display, I instruct the user to open the webbrowser. When he does, he opens a page and my portal with the right page is shown(I can detect this based on the Browser Agent). Then my facebook api start doing its job, and of we go :-)

    Let me know if someone needs some more info on how to detect or maybe even a code sample if necessary.

    Extra Information To capture a user on your own server, redirect every request to your processing page using for example .htaccess. The request is made to a domain with a subfile e.g: http://captive.apple.com/getrT09Nx7G/YNrnUOulnDj/3cfrq3M40iR.html

    To keep multiple users apart, use the unique url the device tries to contact when checking for internet, in this case: /getYT09Nx7G/YN1nUOulnDj/3cfMq3M40iR.html

提交回复
热议问题