0

Okay this should be pretty simple I imagine. I have searched around but everything is over my head. I simply want to put a hyperlink in an application. This app was written by a third party and I have no experience with phonegap. When I click the link, it changes color, but proceeds to do nothing. It doesn't open the link in the app, nor does it open in a browser. So here's what I tried, thinking that it would be as simple as it seemed.

html: '<center><a href="http://www.somesite.com" target="_blank">poo</a></center>'

Here's the full bit of code in which it lies if that helps.

try {
    Ext.define("app.view.login", {
        extend: "Ext.Panel",
        id: "login",
        xtype: "login",
        requires: ["app.widget.entry", "app.widget.loader", "app.widget.notification"],
        config: {
            fullscreen: true,
            background: "white",
            layout: {
                type: "vbox",
                align: "center",
                animation: {
                    type: "slide"
                }
            },
            defaults: {
                width: "90%"
            },
            items: [{
                flex: 1,
                layout: {
                    type: "vbox",
                    align: "center",
                    pack: "justify"
                },
                items: [{
                    xtype: "spacer"
                }, {
                    xtype: "component",
                    width: "100%",
                    html: '<center><a href="http://www.somesite.com" target="_blank">poo</a></center>'
                }, {
                    xtype: "spacer"
                }, ]
            }, {
                flex: 1,
                layout: {
                    type: "vbox",
                    align: "center"
                },
                defaults: {
                    width: "96%"
                },
                items: [{
                    xtype: "entry",
                    label: "User Name",
                    testExists: true
                }, {
                    flex: 1,
                    height: "0.5em"
                }, {
                    xtype: "entry",
                    label: "Password",
                    type: "password",
                    testExists: true
                }, {
                    flex: 1,
                    xtype: "spacer"
                }, {
                    xtype: "button",
                    text: "Login",
                    width: "50%"
                }, {
                    flex: 1,
                    xtype: "spacer"
                }, ]
            }, ]
        },
    })
}

Obviously I don't understand something. Any help would be great. Thanks

Nick
  • 1,903
  • 2
  • 21
  • 40

1 Answers1

0

For opening url in Phonegap you should first added that to white list (external hosts in cordova.plist), unless you added url's there you will face white list rejection error(see your log files) for more information visit : Domain Whitelist Guide

Duke
  • 1,731
  • 2
  • 17
  • 33
  • I have added the domain to the whitelist and I get no error message of any kind, no whitelist rejection. Is there something more to a link in phonegap? It does nothing at all when you click it – Nick Sep 10 '12 at 14:20
  • use ontap event and call window.open(url) and see what happens . – Duke Sep 10 '12 at 17:09
  • Where on earth do you register an event? I've tried something similar to this http://stackoverflow.com/questions/10298683/adding-a-click-event-to-a-span but had no luck. Is it possible to register the tap event in the items list? – Nick Sep 10 '12 at 18:57
  • no need to register just use poo – Duke Sep 11 '12 at 08:07