PDA

View Full Version : Using window.open in a button handler



krezack
24 Feb 2011, 9:07 AM
I am attempting to create a 'Learn More' button that will launch another website but I can't seem to get it to work as I'd like.


var stLearnMoreBtn = new Ext.Button(
{
text:'Learn More',
handler:function(){window.open("http://www.google.com", "_blank")}
});Doing this in chrome i get an alert that a popup has been blocked and on my iphone nothing happens.

What I need is for a new tab to open the same as would happen if my link was on a list. Like:


var stList = new Ext.List(
{
...
});
stList.on("itemtap", function(){window.open("http://www.google.com", "_blank")});Any suggests on how to accomplish this would be greatly appreciated.

thomas12
25 Feb 2011, 5:42 AM
I'm having the same problem. So any help is appreciated from me too :-)

SimonFlack
25 Feb 2011, 5:56 AM
Cant do it. Use a "<a href" and css to style it to look like a button. It will open in a new window on the phone.

I used buttons (facebook, twitter etc) in this app (http://www.whitefox.no/projects/uin) to open an overlay that contained my "<a href". Important to remember that if the app is run in standalone mode that there is no "back" navigation and pressing the app icon on the desktop will reload the app.