[TIMOB-8031] MobileWeb: WebView - Adding a webview to a window doesn't show the content of the url specified when creating the webview
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2014-04-17T22:12:36.000+0000 |
| Affected Version/s | Release 2.0.0 |
| Fix Version/s | n/a |
| Components | MobileWeb |
| Labels | qe-mw020912 |
| Reporter | Michael Pettiford |
| Assignee | Bryan Hughes |
| Created | 2012-03-15T10:41:36.000+0000 |
| Updated | 2014-04-17T22:12:36.000+0000 |
Description
Steps to reproduce
1. Create a default mobile web project and change the code in app.js to the following
var twWindow = Titanium.UI.createWindow({
title: 'Michaels Twitter',
backgroundColor: "#fff",
color: "black",
navBarHidden: true,
fullScreen:true
});
var webview = Ti.UI.createWebView({
url: "http://www.twitter.com",
top: 40
});
twWindow.add(webview);
twWindow.open();
2. Run the app for mobile web
Actual result:
A blank page is displayed
Expected result:
The Twitter home page is displayed
Twitter sets an option called X-Frame-Options to SAMEORIGIN, which means that twitter.com can only be embedded in an iframe (MobileWeb's version of a webview) if the site of the parent is also twitter.com. Since your test obviously isn't running from twitter.com, the request is failing. Change the src to www.appcelerator.com and everything works fine.