1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    130
    Vote Rating
    0
    coooolmagic is on a distinguished road

      0  

    Question how to call a URL on a button click?

    how to call a URL on a button click?


    hi all

    I have a button, how can I call a URL on click of it.
    This button is part of a form panel.

    lets say I want to open http://www.sencha.com on click of it

  2. #2
    Sencha User tysoncadenhead's Avatar
    Join Date
    Jul 2009
    Location
    Nashville TN
    Posts
    16
    Vote Rating
    0
    tysoncadenhead is on a distinguished road

      0  

    Default


    Code:
    {
       xtype: 'button',
       text: 'My Button',
       handler: function(){
          window.location = 'http://sencha.com';
       }
    }
    Tyson Cadenhead
    User Interface Developer
    http://tysonlloydcadenhead.com

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    That is not a good solution.

    Setting window.location is not friendly to the user.

    The user does not know that is supposed to be a link (you usually get a status bar telling you what a click would do)

    Also, you cannot right click it.

    The best solution is a LinkButton

Similar Threads

  1. [RESOLVED]execute a url upon button click
    By erosszz in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 4 Feb 2010, 7:28 PM
  2. How to Call Servlet on Click of Button
    By myworld100us in forum Ext GWT: Discussion
    Replies: 5
    Last Post: 11 Nov 2009, 7:22 AM
  3. set url of a tab on a button click
    By sabyasachibose in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 5 Jan 2008, 11:49 AM
  4. on click of the row on grid want to call a url
    By vikas.r30 in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 28 Dec 2007, 3:37 AM

Thread Participants: 2