Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Open new Page on new Browser (tab) application ?

    Hy, how to open a link in a new Browser Application ?

    We can do something like this :
    Code:
    HTMLPane paneLink = new HTMLPane();  
    paneLink.setContents("<a href=\"http://google.com\" target=\"_blank\">Open Google</a>");
    But, how to open (without human click) a new Page on a new Browser (tab) applications, from a Menu and MenuItem ? like this :

    Code:
    final Menu menu = new Menu();
    
    MenuItem editItem = new MenuItem("Edit);
    MenuItem viewItem = new MenuItem("View");
    
    editItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
    
    	public void onClick(MenuItemClickEvent event) {
    		SC.say("Try to redirect.");
    		// HOW TO REDIRECT IN NEW BROWSER PAGE ?...
    		String url = "http://forums.smartclient.com/showthread.php?t=";
    		int id = 4794;
    		// PAGE.OPEN.NEW.to(url+id);
    	}
    	
    });
    
    menu.setItems(editItem , viewItem);

    #2
    Must be create new method write from JSNI like it's explain on http://dotclear.placeoweb.com/post/G...-de-javascript ?

    Comment


      #3
      Use com.google.gwt.user.client.Window.open(..)

      Comment


        #4
        Using Window.open(url, name, features) with empty features, result opening a new tab open WITH FOCUS.

        Without features => new tab + focus
        With no empty features parameters => new window + focus

        developer.mozilla.org - window.open explain :

        Avoid resorting to window.open()
        Generally speaking, it is preferable to avoid resorting to window.open() for several reasons
        How to open new window in new tab without focus ? (pop-up under)

        Features aguments "alwaysLowered" and "z-lock" changes nothing...

        Comment


          #5
          I used
          Code:
          Window.open(verificationPath, "_self", "");
          and this worked
          Last edited by sanjeev.pk; 29 Oct 2009, 03:29.

          Comment


            #6
            No, it's open on self tab, i want open new tab, without get focus (like mouse whell click).

            Code:
            	@Override
            	public void onModuleLoad() {
            		VLayout vLa = new VLayout();
            		vLa.setBorder("2px solid blue");
            				
            		Button b0 = new Button("B0 com.google.gwt.user.client.Window.open(URL,_self,'')");
            		b0.addClickHandler(new ClickHandler() {
            
            			@Override
            			public void onClick(ClickEvent event) {
            				com.google.gwt.user.client.Window.open("http://www.perdu.com","_self","");				
            			}
            				
            		});		
            		
            		Button b1 = new Button("B1 com.google.gwt.user.client.Window.open(URL,_blank,null)");
            		b1.addClickHandler(new ClickHandler() {
            
            			@Override
            			public void onClick(ClickEvent event) {
            				com.google.gwt.user.client.Window.open("http://www.perdu.com","_blank",null);				
            			}
            				
            		});
            		
            		Button b2 = new Button("B2 com.google.gwt.user.client.Window.open(URL,_blank,null)");
            		b2.addClickHandler(new ClickHandler() {
            
            			@Override
            			public void onClick(ClickEvent event) {
            				com.google.gwt.user.client.Window.open("http://www.perdu.com",null,null);				
            			}
            				
            		});
            
            		vLa.setMembers( b0 , b1 , b2 );
            		
            		RootPanel.get().add(vLa);
            	}

            Comment


              #7
              why are you mixing smartGWT and GWT? You shouldn't even use the
              Code:
               RootPanel.get().add(vLa);
              Instead you should use
              Code:
              vLa.draw()

              Comment

              Working...
              X