小编her*_*a87的帖子

Google + HTML登录无法使用IE或Firefox

我正在开发一个通过Google + API使用客户端身份验证的网络应用.我使用了Google的一个修改示例,该示例使用带有应用信息的HTML元素和一些Javascript来处理响应.在Chrome中一切都很好但在IE 9+和Fierfox中我无法启动身份验证.

HTML:

<div id="signin-button" class="hide">
    <div class="g-signin"
         data-callback="loginFinishedCallback"
         data-clientid="{my client id}"
         data-scope="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.profile.emails.read"
         data-cookiepolicy="single_host_origin"
    >
</div>
Run Code Online (Sandbox Code Playgroud)

使用Javascript:

<script src="https://apis.google.com/js/client:plusone.js" type="text/javascript"></script>
<script type="text/javascript">

        var profile, email;

        function loginFinishedCallback(authResult) {
            if (authResult) {
                if (authResult['error'] == undefined){
                    gapi.client.load('plus','v1', loadProfile);  // Trigger request to get the email address.
                } else {
                    console.log('An error occurred');
                    $( "#signin-button" ).removeClass( "hide" ).addClass( "show" );
                }
            } else {
                console.log('Empty authResult');  // Something went wrong
                $( "#signin-button" ).removeClass( "hide" ).addClass( "show" );
            }
        } …
Run Code Online (Sandbox Code Playgroud)

google-api google-authentication google-oauth

7
推荐指数
0
解决办法
886
查看次数

简单日期格式无法正确格式化

我正在编写一个程序,需要能够使用java.util.date格式找到两个日期之间的差异.我正在使用SimpleDateFormat类来解析字符串输入,但它似乎解析错误.这是我的代码.我感谢任何帮助

SimpleDateFormat s = new SimpleDateFormat("yyyy/mm/dd");
Date startDate = s.parse(dateField.getText()); //input is 2012/03/10
System.out.println(START_DATE);//output is Tue Jan 10 00:03:00 MST 2012      
Run Code Online (Sandbox Code Playgroud)

java simpledateformat

0
推荐指数
1
解决办法
2048
查看次数