小编Hum*_*ing的帖子

window.onbeforeunload和window.onunload在Firefox,Safari,Opera中不起作用?

在我的聊天应用程序中,当我的应用程序关闭时,我需要得到用户的确认.

所以我使用了window.onbeforeunload确认警报和window.onunloadlogout().

  1. 但这两个功能都在IE和Chrome中运行.(应用程序运行正常)

  2. window.onbeforeunload 没有在Opera工作,我的消息将不会在Firefox中显示.

  3. window.onunload 不适用于Safari,Opera和Firefox.

我的javaScript代码将是,

// Used for confirmation , to closing the window 
window.onbeforeunload = function () {

    return  "Are you sure want to LOGOUT the session ?";
}; 

// Used to logout the session , when browser window was closed 
window.onunload = function () {

    if((sessionId != null)&&(sessionId!="null")&& (sessionId != ""))
        logout();
};
Run Code Online (Sandbox Code Playgroud)

我也尝试了与JQuery相同的功能,

<script type="text/javascript">

    $(window).on('beforeunload', function() {
        return 'Are you sure want to LOGOUT the session ?';
    });

    $(window).unload(function() …
Run Code Online (Sandbox Code Playgroud)

javascript jquery javascript-events

73
推荐指数
5
解决办法
18万
查看次数

群集和负载平衡之间的区别?

群集负载平衡有什么区别?

我知道这是一个简单的问题.但我向几个人提出了这个问题,但没有人给出可靠的答案.

我也google了很多,无法得到确切的答案.

希望我们的Stack用户能为我提供最好的答案.

java tomcat web-applications cluster-computing

43
推荐指数
3
解决办法
5万
查看次数

如何在HttpClient的请求中添加,设置和获取Header?

在我的应用程序中,我需要在请求中设置标题,我需要在控制台中打印标题值...所以请举例说明HttpClient或在我的代码中编辑它...

我的代码是,

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;

public class SimpleHttpPut { 
  public static void main(String[] args) {
    HttpClient client = new DefaultHttpClient();
    HttpPost post = new HttpPost("http://http://localhost:8089/CustomerChatSwing/JoinAction");
    try {
      List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
      nameValuePairs.add(new BasicNameValuePair("userId",
      "123456789"));
      post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

      HttpResponse response = client.execute(post);
      BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
      String line = "";
      while ((line = rd.readLine()) != null) {
    System.out.println(line); …
Run Code Online (Sandbox Code Playgroud)

java servlets http httpclient apache-httpclient-4.x

24
推荐指数
2
解决办法
9万
查看次数

在春天用AOP登录?

我是新来的,在我的办公室里.所以我没有指导.

我需要AOP使用the 来实现日志记录log4j.

我在没有AOP基本spring MVC示例的情况下实现了日志记录?

AOP使用了aspectJ没有记录的小样本(只是制作了Sysout)?

我不知道如何整合它?

任何人都可以给我一个启动想法吗?

很好的答案肯定赞赏...

java spring log4j aspectj spring-mvc

18
推荐指数
1
解决办法
4万
查看次数

使用aspectJ在AOP中使用Joinpoint VS ProceedingJoinPoint?

谁能告诉我Joinpoint和 之间有什么区别 Proceedingjoinpoint

何时使用JoinpointProceedingjoinpoint方面类的方法?

我用过JoinPointAspectJ class喜欢的,

@Pointcut("execution(* com.pointel.aop.test1.AopTest.beforeAspect(..))")  
public void adviceChild(){}  

@Before("adviceChild()")  
public void beforeAdvicing(JoinPoint joinPoint /*,ProceedingJoinPoint pjp - used refer book marks of AOP*/){ 

    //Used to get the parameters of the method !
    Object[] arguments = joinPoint.getArgs();
    for (Object object : arguments) {
        System.out.println("List of parameters : " + object);
    }

    System.out.println("Method name : " + joinPoint.getSignature().getName());
    log.info("beforeAdvicing...........****************...........");
    log.info("Method name : " + joinPoint.getSignature().getName());
    System.out.println("************************"); 
}
Run Code Online (Sandbox Code Playgroud)

但我在其他资源中看到的一些是,

@Around("execution(* …
Run Code Online (Sandbox Code Playgroud)

java spring aspectj spring-aop

18
推荐指数
2
解决办法
3万
查看次数

设置窗口最小化浏览器的最小大小限制?

有没有办法在所有浏览器中手动设置浏览器窗口的最小大小?

html javascript css browser cross-browser

13
推荐指数
2
解决办法
7万
查看次数

当用户点击时,如何避免复选框周围的虚线?

当用户单击IE中的复选框时,我需要避免在复选框周围创建虚线.

查看用户点击时的显示方式

在此输入图像描述

如何使用复选框删除虚线css

html css checkbox internet-explorer

11
推荐指数
1
解决办法
5581
查看次数

动画背景颜色就像jQuery中的进度条

我有一个div有一些文本内容(例如:我的名字),div红色 background colour和一个按钮.

我的需要:

如果我点击了按钮,我需要从改变div的背景红色到蓝色喜欢Progress bar10秒 .Something一样,

从0秒开始

=

==

===

====

=====

======

=======

========

=========

==========

以10秒结束

我必须从头到尾逐渐改变bgColor达10秒.

所以我使用了JQuery animate()方法.但是我没有运气这样做.

我尝试过的:

  $("button").click(function(){ 
        $('#myDivId').animate({background-color:'blue'},10000);
  });
Run Code Online (Sandbox Code Playgroud)

如果这是不可能的,任何人都可以建议我做一些插件.

希望我们的堆栈用户能帮助我.

css jquery jquery-ui jquery-effects progress-bar

11
推荐指数
2
解决办法
2万
查看次数

Angular2 - http调用代码覆盖率

我的组件是,

 getHomePageData() : void{
    this.homeservice.getHomePageData()
          .subscribe(
              data =>   {

                            //console.log("response status ################### "+data.status);
                            //console.log("getUserData response ************ \n"+JSON.stringify(data));
                            this.defaultFacilityId = data.response.defaultFacilityId;
                            this.defaultFacilityName = data.response.defaultFacilityName;
                            this.enterpriseId = data.response.enterpriseId;
                            this.enterpriseName = data.response.enterpriseName;
                            this.facilityList = data.response.facilityList;
                            this.userName = data.response.userName;

                            this.showDefaultPopoup();
                        },
              error =>  {
                            console.error(error);
                            //this.errorMessage="Technical error - Contact Support team !" ;
                        }
          );

  }
Run Code Online (Sandbox Code Playgroud)

所以我的component.spec.ts是,

 it('getHomePageData with SUCCESS - getHomePageData()', () => {
    backend.connections.subscribe((connection: MockConnection) => {
      //expect(connection.request.url).toEqual('http://localhost:8080/MSMTestWebApp/UDM/UdmService/Home/');
      expect(connection.request.url).toEqual('http://192.168.61.158:9080/GetUserData');

      expect(connection.request.method).toEqual(RequestMethod.Get);
      expect(connection.request.headers.get('Content-Type')).toEqual('application/json');
      let options = new ResponseOptions({
        body:
        {
          "request": { "url": "/getUserData" …
Run Code Online (Sandbox Code Playgroud)

code-coverage http jasmine istanbul angular

11
推荐指数
2
解决办法
575
查看次数

Spring - 应用程序初始化两次?

当我开始运行我的春天应用程序我的tomcat时,会ContextRefreshedEvent发生两次火灾.请参阅StackTrace.

Dec 20, 2013 6:07:56 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:SpringValidations' did not find a matching property.
Dec 20, 2013 6:07:56 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;F:\sub\svn\bin;%DERBY_HOME%\bin;D:\Lal\Lab\SW\apache-maven-3.0.4/bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_25\bin;;F:\Eclipse\sts-2.9.2.RELEASE;
Dec 20, 2013 6:07:56 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Dec 20, 2013 …
Run Code Online (Sandbox Code Playgroud)

java spring web-applications initialization spring-mvc

10
推荐指数
2
解决办法
2万
查看次数