PDA

View Full Version : How open link in browser device when WebApp is saved on homescreen



kevinv1990
4 May 2011, 11:46 PM
Hello everyone,

I use linkedin within Sencha Touch, this all works great. But when users save the webapp to the home screen, the link won't open in safari.

I use this:


<a href="#" onclick="hireserve.controllers.authorize();">Gebruik linkedin account<a>
And the onclick function:



hireserve.controllers.authorize = function() {
IN.User.authorize(hireserve.controllers.authcallback);
}
So when i press this link in the webapp, a white screen is shown, anyone know how to target the browser and if this is possible?

Kevin

kevinv1990
10 May 2011, 6:22 AM
Pls help, I really need this.

dmillasich
11 May 2011, 6:29 AM
To troubleshoot this, have you tried replacing the content of the "authorize" function with something other than the "IN.User.authorize(...)" code? For example:



hireserve.controllers.authorize = function() {
Ext.Msg.alert("link", "pressed");
}


The reason I ask is that I had a similar problem calling out to a Netflix link from an app that was saved to the home screen. The problem had to do with the way Netflix was working with the Home Screen application. The app worked perfectly fine when started from within Safari.

kevinv1990
31 May 2011, 1:02 AM
Okay,when i do that i see "link pressed" in the alert box.

So this means that the webapp execute the handler right?

It's still strange why i get white screen...

dmillasich
31 May 2011, 5:25 AM
it sounds like the app is bombing out for some reason. are you sure this runs error free in a safari on something other than an iPad? have you checked the debug console on a PC or Mac?

kevinv1990
31 May 2011, 5:28 AM
hey thx a lot for the reply.

Well it completely works in Safari on Iphone 3 and 4.

But I checked the error console again, and maybe you right, i get this:

Unsafe JavaScript attempt to access frame with URL http://deloitte.hireserve-dev.com/pls/internet10g/ic_mobile_touch.screen?p_web_site_id=-2825001002825# from frame with URL https://platform.linkedin.com/js/xdrpchtml?v=0.0.1118-RC2.6177-1337#xdm_e=http%3A%2F%2Fdeloitte.hireserve-dev.com&xdm_c=li_gen_1306848488718_0&xdm_p=1&target=li_gen_1306848488718_0&width=600&height=400&mode=popup. Domains, protocols and ports must match.


Can this be the problem?

dmillasich
31 May 2011, 4:12 PM
That message is legitimate. I get it all of the time as well when I spin up a youtube video from our app. So no - unfortunately that's not the problem you're facing.

Just out of curiosity, what version if iOS are you running on the iPad. Is it current? Also, which version of the Sencha Touch API are you working with?

kevinv1990
6 Jun 2011, 11:21 PM
iOS 4.1 and 4.3.3 tested, both with same result.

As far as I know, last version of the API and last version of ST ;)

Anyone has a working example? Would appreciate it.

dmillasich
7 Jun 2011, 9:55 AM
You know - this example that I'm about to provide is so simple that I'm afraid it's not going to be what you're looking for. However, from what I understand, you're trying to get an externallink to open from a safari session instantiated from a link saved to the home screen.

That's what this particular example does - that is, it provides a link that navigates to a linkedin url. I've tested it using my iPad, launching the app from the home screen here: http://test.nanocrowd.com/externallink

My apologies if this is not what you're looking for. And with that - here's the code:



Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {
var rootPanel = new Ext.Panel({
fullscreen: true,
layout: 'card',
defaults: {
flex: 1,
},
items:[],
dockedItems:[{
dock: 'top',
html: '<p style="text-align:center;padding-top:50px;"><a href="http://www.linkedin.com/?trk=hb-0-h-logo" target="_blank"> LinkedIn</a></p>'
},{
xtype: 'toolbar',
dock: 'bottom',
items: [
]
}],
});
}
});