Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Open a webpage in a tab

I'm i missing something?

var webview = Titanium.UI.createWebView({url:'http:/www.apple.com/', scalesPageToFit:false});
    var window = Titanium.UI.createWindow();
    window.add(webview);
    window.open();

This opens the page in fullscreen…
I want to maintain the top and bottom bar…

Tried using Titanium.UI.currentTab.open(window); instead of window.open(); but it gives me a different top bar with a back button…

Any ideas…

Just need a simple webview inside a tab : )

— asked April 17th 2010 by Helder Luis
  • webview iphone help
0 Comments

2 Answers

  • Update…
    I'm using the following code, but getting the error:
    Can't find variable: win at 03.js (line 8).

    var w = Titanium.UI.currentWindow;
    w.orientationModes = [Titanium.UI.PORTRAIT]; 
    
    var webview = Ti.UI.createWebView();
        webview.url = 'http://www.apple.com';
        webview.scalesPageToFit = false;
        w.add(webview);
        win.tab.open(w);
    

    Also after openning the page how can i open links in a new window (showing a go back button)?

    Thanks…

    — answered April 18th 2010 by Helder Luis
    permalink
    0 Comments
  • Try this. Just worked it out. This will open a webpage from a single tab and keep the tabs working (although I see you did post this a long time ago!). If not for you then for whoever may find this useful…

    Cheers

    John

    var w = Ti.UI.currentWindow;
    
    w.orientationModes = [Titanium.UI.PORTRAIT]; 
    
    var webview = Ti.UI.createWebView();
        webview.url = 'http://sciencefictionworld.com';
        webview.scalesPageToFit = false;
        w.add(webview);
    
    — answered September 27th 2010 by John Howell
    permalink
    1 Comment
    • Thanks a lot for this, it was what I was looking for!

      — commented December 1st 2010 by CallMePaul
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.