About Customized Post-authentication Page
[Modification Logs] Added wiwizGetDisconnectLink(). (Mar 5, 2013) Added URL parameter t (tokencode) and mac. (Oct 16, 2015) Added URL parameter us (userstring), added wiwizGetUserString(). (Apr 29, 2017) |
Generally, users of of the hotspot will see a default post-authentication page after he connects to your hotspot and completes the authentication. There are something very useful to the user on the page, such as the user’s original requested URL, remaining connection time, connection ending time, bulletin set by the owner of the hotspot, system messages, some other links and so on.
Alternatively, the owner of a hotspot can also make his/her own post-authentication page to meet his/her needs. You can just set URL Redirection or Customized HTML of Customized Post-authentication Page when editing a hotspot in Wiwiz Web Panel. Then, users of of the hotspot will see this customized post-authentication page which is made by the owner of the hotspot instead.
We provide development interfaces to let the owner of a hotspot use within his/her customized post-authentication page, so that the users of the hotspot can see the same information as that in the default post-authentication page.
There are two types of these interfaces. One is URL parameters, the other one is Javascript functions. Please read the following content for details.
1. URL parameters:
url - The user’s orginal requested URL
et – Connection ending time
rm – Remaining connection time
t – tokencode of an authentication
mac – MAC address of the client device
us – Track Data (userstring)
2. Javascript functions:
2.1. Prerequisite
Please be aware that you need add the following codes first before calling the Javascript functions:
in case of “URL Redirection”:
<script src="http://cp.wiwiz.com/as/s/portal/?js=1&gw_id=XXXX"></script>
XXXX stands for the Hotspot ID.
in case of “URL Redirection”:
<script src="/as/s/portal/?js=1"></script>
2.2. Functions to call
2.2.1. wiwizGetEndingTime() - Returns connection ending time.
2.2.2. wiwizGetRemaining() - Returns remaining connection time (in seconds).
2.2.3. wiwizShowCountdown(d, h, m, s) - shows the remaining time as count down.
Parameters: “d”, “h”, “m”, “s” stand for the seperators of day, hour, minute and second. Default seperators will be used if they are not specified.
Example: wiwizShowCountdown(" days ", " hours ", " minutes ", " seconds ");
2.2.4. wiwizCountdownNotice(tm, msg) - Sets a message when counting down. Show the message text “msg” at “tm” seconds before connection ending time.
Parameters:
tm stands for the second before connection ends.
msg stands for the text of the message.
2.2.5. wiwizGetBulletin() – Shows bulletin set in Wiwiz Web Panel.
2.2.6. wiwizGetDisconnectLink() – Retrieves the URL for shutting down authenticated connection by user’s self.
Returns: an URL – this URL can only be requested in user’s web browser. The response will be in the following patterns:
Response | Description |
wiwiz_user_disconnect(0) | The connection will shutdown immediately. |
wiwiz_user_disconnect(1) | The connection cannot shut down immediately, but will in 1~2 minutes. |
wiwiz_user_disconnect(2) | The connection does not exist or already shut down. |
Sample:
var url = wiwizGetDisconnectLink();
var script = document.createElement('script');
script.setAttribute('src', url);
document.getElementsByTagName('head')[0].appendChild(script);
function wiwiz_user_disconnect(s) {
switch(s) {
case 0:
alert("The connection will shutdown immediately.");
break;
case 1:
alert("The connection will shutdown in seconds.");
break;
case 2:
alert("The connection does not exist or already shut down.");
break;
}
}
2.2.7. wiwizGetUserString() - Returns Track Data (userstring).
2.3. Rewritable functions:
2.3.1. Messages will be shown in default style after wiwizCountdownNotice() is called. If you’d like to show them in your way, you can rewrite the function wiwizUpdateNotice(str) . Parameter str stands for the text of the message.
Example:
function wiwizUpdateNotice(str) {
alert(str); //alert the message
}
2.3.2. Bulletin will be shown in default style after wiwizGetBulletin() is called. If you’d like to show it in your way, you can rewrite the function wiwizUpdateBulletin(title, content) . Parameter “title” stands for title of the bulletin, “content” stands for the content in the bulletin.
Example:
function wiwizUpdateBulletin(title, content)
alert(title + "\n" + content); //alert the bulletin
}
2.3.3. When the user is running out of traffic of bandwidth, wiwizTrafficAlert() will be called, which you can rewrite to implement your own traffic warning.