以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  如何限制网页只能在微信内置浏览器中打开?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=121964)

--  作者:郭元友
--  发布时间:2018/7/16 16:29:00
--  如何限制网页只能在微信内置浏览器中打开?

移动开发,如何限制网页只能在微信内置浏览器中打开?



即附件所示的网
此主题相关图片如下:网址.jpg
按此在新窗口浏览图片
址隐藏掉,或者用自建应用的模块名称“审批”代替

--  作者:有点甜
--  发布时间:2018/7/16 16:45:00
--  

方法一:加入授权

 

http://www.foxtable.com/mobilehelp/scr/0235.htm

 

方法二:判断浏览器信息

 


Select Case e.Path
    Case "test.htm", ""
        msgbox(e.request.UserAgent )
        Dim agent As String = e.request.UserAgent
        If agent.contains("MicroMessenger") Then
            msgbox("微信")
        Else
            Dim flag As Boolean = False
            Dim keywords As String() = {"Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser"}
            \'排除 Windows 桌面系统
            If Not agent.Contains("Windows NT") OrElse (agent.Contains("Windows NT") AndAlso agent.Contains("compatible; MSIE 9.0;")) Then
                \'排除 苹果桌面系统
                If Not agent.Contains("Windows NT") AndAlso Not agent.Contains("Macintosh") Then
                    For Each item As String In keywords
                        If agent.Contains(item) Then
                            msgbox(item)
                            flag = True
                            Exit For
                        End If
                    Next
                End If
            End If
            If flag Then
                msgbox("手机")
            Else
                msgbox("电脑")
            End If
        End If
End Select