Webview does not work!

You must Login before you can answer or comment on any questions.

I created a label. I added an event. I copied the webview example from documentation.. But does not work.. The only problem that may come to my mind is: can cause problems since the window from which I opened the link has the option modal: true? Thanks!

var info1 = Titanium.UI.createLabel({
        color:"#FFF",
        text:'Maggiori Informazioni',
        font: { fontSize: 16 },
        textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
        width: 250, 
        height: 20,
        top: 80
    });
 
    info1.addEventListener('click', function(){
        var wi = Titanium.UI.createWindow({
            backgroundColor:'#790000'
        });
 
        var info = Titanium.UI.createWebView({
            color:'#FFF',
            url:'http://www.teatrosalieri.it/index.asp?m0=cartellonedett&tipo=musica&month=10&year=2012&id=3318'
        });
 
        wi.add(info);
        wi.open({modal:true});
    });

2 Answers

Hello Filippo,

See this works fine for me...

var tabGroup = Titanium.UI.createTabGroup();
 
var osname = Ti.Platform.osname;
 
var win1 = Titanium.UI.createWindow({
    title : 'Testing',
    backgroundColor : '#1a212b',
});
 
var tab1 = Titanium.UI.createTab({
    icon : 'KS_nav_ui.png',
    title : 'Home',
    window : win1
});
 
tabGroup.addTab(tab1);
tabGroup.open();
 
var info1 = Titanium.UI.createLabel({
    color : "#FFF",
    text : 'Maggiori Informazioni',
    font : {
        fontSize : 16
    },
    textAlign : Ti.UI.TEXT_ALIGNMENT_LEFT,
    width : 250,
    height : 20,
    top : 80
});
 
 
info1.addEventListener('click', function() {
    var wi = Titanium.UI.createWindow({
        backgroundColor : '#790000'
    });
 
    var info = Titanium.UI.createWebView({
        color : '#FFF',
        url : 'http://www.teatrosalieri.it/index.asp?m0=cartellonedett&tipo=musica&month=10&year=2012&id=3318',
        // backgroundColor : 'pink'
    });
 
    wi.add(info);
    wi.open({
        modal : true
    });
});
 
win1.add(info1);

— answered 8 months ago by Ritesh .
answer permalink
1 Comment
  • In this case I'm not working with the application tab group .. but with a window connected to the application tab group ... so .. apptabgroup-> window-> webview

    — commented 8 months ago by Filippo Perbellini

Hi Filippo, i see your code and feel that modal window code should be like this:-

var wi = Titanium.UI.createWindow({
            backgroundColor:'#790000',
        modal:true
        });
 
        var info = Titanium.UI.createWebView({
            color:'#FFF',
            url:'http://www.teatrosalieri.it/index.asp?m0=cartellonedett&tipo=musica&month=10&year=2012&id=3318'
        });
 
        wi.add(info);
        wi.open();

There is no problem to open a window as modal:true

what is the problem exactly you are facing and try this code.

Your Answer

Think you can help? Login to answer this question!