WebView Controls?

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

Hello, i am trying to make goBack and GoForward buttons for my webview, but nothing happens? Where is my mistake?

var myWin = Ti.UI.createWindow({
            title:'',
            barColor:barcolor_ui            
        });
        var myAdress = Ti.UI.createWebView({
            url:e.source.link,
            bottom:50
        });
        myWin.add(myAdress);
 
        var closeBTN = Ti.UI.createButton({
            title:'Close'
        });
        closeBTN.addEventListener("click",function(e){
            myWin.close();
        });
        myWin.setLeftNavButton(closeBTN);
        var safari = Ti.UI.createButton({
            title:'Open at Safari'
        });
        safari.addEventListener("click",function(e){
            Ti.Platform.openURL(myAdress.url);
            Ti.API.info("URL to GO:"+myAdress.url);
 
        });
        var flexSpace = Ti.UI.createButton({
        systemButton : Ti.UI.iPhone.SystemButton.FLEXIBLE_SPACE
    });
 
    var leftButton = Ti.UI.createButton({
        image : 'images/icon_arrow_left.png'
    });
 
    leftButton.addEventListener('click', function() {
        myAdress.goBack();
    });
    var rightButton = Ti.UI.createButton({
        image : 'images/icon_arrow_right.png'
    });
 
    rightButton.addEventListener('click', function() {
 
    });
 
 
 
        var toolbar = Ti.UI.iOS.createToolbar({
        items : [ flexSpace, leftButton, flexSpace, rightButton, flexSpace ],
        bottom : 0,
        borderTop : true,
        borderBottom : true,
        //barImage:barimage_ui,
        backgroundImage:background_ui,
        barColor : barcolor_ui
        });
 
 
        myWin.add(toolbar);
        myWin.setRightNavButton(safari);
        myWin.open({modal:true});

1 Answer

Accepted Answer

Hi Gurkan,

I think you forgot to write goForward() function in your right button.

rightButton.addEventListener('click', function() {
        myAdress.goForward();
    });

— answered 11 months ago by Nitin Chavda
answer permalink
3 Comments
  • Whole code doesn't work not only the right button , I have looked everywhere but couldn't find how a work?

    — commented 11 months ago by Graham Jeffrey

  • Have you tried changing url of webView?.

    — commented 11 months ago by Nitin Chavda

  • yes the problem is the url, i don't understand why but when i change url it works, thank you

    — commented 11 months ago by Graham Jeffrey

Your Answer

Think you can help? Login to answer this question!