小编Sur*_*ali的帖子

隐藏浏览器的地址栏(弹出窗口)

我必须隐藏浏览器的地址栏.我正在使用此代码:

var winFeature =
        'location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes';
window.open('Result.html','null',winFeature);  
Run Code Online (Sandbox Code Playgroud)

在许多解决方案中,只需该location=no属性可以隐藏地址栏(在IE和Chrome中).但是,这对我不起作用(即使在IE和Chrome中也是如此).

最后,我找到了一篇MSDN文章,描述了如何location=no简单地隐藏后退/前进/停止导航按钮,并使地址栏为只读.

是否有任何解决方案隐藏上面的MSDN文章隐藏整个地址栏? 我正在IE和谷歌Chrome中测试.

javascript address-bar navigationbar

44
推荐指数
5
解决办法
19万
查看次数

如何从Postman休息客户端发送spring csrf令牌?

我在spring框架中有csrf保护.所以在每个请求中,我从ajax调用中在头文件中发送csrf令牌,这非常有效.

<meta name="_csrf" content="${_csrf.token}"/>
<meta name="_csrf_header" content="${_csrf.headerName}"/>

var token = $("meta[name='_csrf']").attr("content");
var header = $("meta[name='_csrf_header']").attr("content");
Run Code Online (Sandbox Code Playgroud)

在ajax

beforeSend: function(xhr) {
                xhr.setRequestHeader(header, token),
                xhr.setRequestHeader("username", "xxxx1"),
                xhr.setRequestHeader("password", "password")
            }
Run Code Online (Sandbox Code Playgroud)

我不知道生成csrf令牌并包含在Postman Rest Client的标题部分?你能帮我从Postman Rest Client发送csrf令牌吗? 在此输入图像描述

rest spring header csrf postman

44
推荐指数
3
解决办法
8万
查看次数

如何在Chrome中检测弹出窗口拦截器?

我在堆栈溢出中搜索了很多问题,可能在这里 重复检测Popup

not helped for me同时,在测试中(测试v26.0.1410.64)
下面的方法Worked in IE and Firefox,但not in Chrome

var popup = window.open(winPath,winName,winFeature,true);
 if (!popup || popup.closed || typeof popup.closed=='undefined'){
       //Worked For IE and Firefox
        alert("Popup Blocker is enabled! Please add this site to your exception list.");
        window.location.href = 'warning.html';
 } else {
        //Popup Allowed
        window.open('','_self');
        window.close();
} 
Run Code Online (Sandbox Code Playgroud)

任何适用于Chrome的更好的解决方案呢?

javascript jquery google-chrome popup-blocker

15
推荐指数
1
解决办法
3万
查看次数

掩盖String的某些部分

我有电话号码和电子邮件地址.我不想显示完整的信息.
所以我在想使用Regex或MaskFormatter掩盖一些角色.

输入和期望的结果

1) 9843444556 -  98*******6   
2) test@mint.com - t***@****.com 
Run Code Online (Sandbox Code Playgroud)

我用String循环实现了这一点.但我确实想通过使用正则表达式或掩码来实现这一点.请你告诉它吗?

java regex mask

8
推荐指数
1
解决办法
6610
查看次数

gson.toJson(对象)BigDecimal Precision Lost

当我将Object转换为Json时,我遇到了BigDecimal Precision丢失的问题.
让我说我有Pojo课,

public class DummyPojo {
    private BigDecimal amount;
    private String id;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public BigDecimal getAmount() {
        return amount;
    }
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
} 
Run Code Online (Sandbox Code Playgroud)

现在我正在为Pojo设置值,然后转换为JSON

public static void main(String[] args) {
        BigDecimal big = new BigDecimal("1000.0005");
        JSONObject resultJson = new JSONObject();
        DummyPojo summary = new DummyPojo();
        summary.setId("A001");
        summary.setAmount(big);

        resultJson.put("summary",new Gson().toJson(summary));
        String result = resultJson.toString();
        System.out.println(result);
    }
Run Code Online (Sandbox Code Playgroud)

第一次测试 - …

java json gson jsonobject

5
推荐指数
1
解决办法
4979
查看次数

未捕获的TypeError:对象[对象对象]没有方法'打开'

我将尝试这个:http://jquerytools.org/demos/scrollable/index.html
但没有任何事件触发器,我得到以下错误

在此输入图像描述

但我很困惑,为什么on方法甚至没有找到页面加载

<head>
<link href="css/scrollable-horizontal.css" rel="stylesheet" type="text/css" />
<link href="css/scrollable-buttons.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.6.1.min.js"></script>
<script src="js/jquery.tools.min.js"></script>
</head>  
Run Code Online (Sandbox Code Playgroud)

javascript部分没有做任何事情

<script>
$(function() {
  // initialize scrollable
  $(".scrollable").scrollable();
});
</script>  
Run Code Online (Sandbox Code Playgroud)

它阻止了我的进一步实施.对此有什么想法?

javascript jquery google-chrome scrollable

2
推荐指数
1
解决办法
2163
查看次数