PDA

View Full Version : Open new browser windows on Android and iPhone



ngardner
14 Apr 2011, 10:59 AM
Is there a way to get the browsers to open a new window in all environments?

This works on iPad when using safari


listeners: {
click: {
element: 'el',
fn: function() { window.open('http://google.com','_blank'); }
}
}


but it does not work on iPad when launching the site from the home screen.
It also does not work on Android in any case.

I cannot use <a href="google.com" target="_blank"/> as I need these windows opened via JS.

Anyone have a solution that works across all environments?

markwyner
14 Apr 2011, 11:41 AM
You actually need to update the AppDelegate.m file. There's a Sencha Touch post about this (http://www.sencha.com/forum/showthread.php?123715-How-to-redirect-link-in-application-ti-Safari-....) which explains what to do. Basically this forces the device to trigger Safari for all HTML links rather than using webview.

I hope that helps.

ngardner
14 Apr 2011, 1:01 PM
That looks like its for native apps? I need a solution that works for mobile sites on both iPhone/iPad and Android

markwyner
14 Apr 2011, 4:58 PM
You're right. My apologies. I misunderstood your situation. Unfortunately I have nothing for you on this.

jwsloan
4 Aug 2011, 6:23 AM
I am experiencing the exact same thing. Have you found a solution?

Update -
I turned off the popup blocker on my Android emulator, and it works fine now. However, turning the popup blocker off on the iPhone made no difference.

gordonjl
22 Aug 2011, 9:46 AM
I found a fix for this that worked for me. I documented what I did on via this thread:

http://www.sencha.com/forum/showthread.php?130358-window.open()-from-toolbar-button-opens-window-from-list-item-a-new-tab&p=639938#post639938

The original poster had an issue with multiple windows opening up, but things worked great for my needs.