[TIMOB-24397] iOS: WebView - load a webpage with request headers
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-02-16T17:56:21.000+0000 |
Affected Version/s | Release 6.1.0 |
Fix Version/s | Release 6.1.0 |
Components | iOS |
Labels | ios, regression |
Reporter | Christoph Eck |
Assignee | Hans Knöchel |
Created | 2017-02-10T12:58:26.000+0000 |
Updated | 2017-03-03T17:33:22.000+0000 |
Description
*Problem*
Opening a webpage like https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending with request headers does not work.
_actual behavior_
click on 'open web page'
in the log is shown
{noformat} [INFO] : beforeload: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending [INFO] : beforeload: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending [INFO] : load: about:blank [INFO] : beforeload: about:blank [INFO] : beforeload: about:blank [INFO] : beforeload: about:blank [INFO] : beforeload: about:blank {noformat}webpage is not loaded
_expected behavior_click on 'open web page'
in the log is shown
{noformat} [INFO] : beforeload: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending [INFO] : beforeload: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending [INFO] : load: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending {noformat}webpage is loaded
*Test case* file index.js
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
var openButton = Ti.UI.createButton({
title : 'Open web page',
top : '200',
height : Ti.UI.SIZE,
left : '30',
});
openButton.addEventListener('click', function() {
var ldf = Ti.Platform.displayCaps.logicalDensityFactor;
var webView = Ti.UI.createWebView({
height : Math.floor(Ti.Platform.displayCaps.platformHeight / ldf),
width : Math.floor(Ti.Platform.displayCaps.platformWidth / ldf),
backgroundColor : "white",
});
webView.setBasicAuthentication("username", "password");
var requestHeaders = {
"Accept-Language" : "en",
"X-Agent" : "Mobile"
};
webView.setRequestHeaders(requestHeaders);
webView.addEventListener('load', function() {
Ti.API.info('load: ' + webView.url);
});
webView.addEventListener('beforeload', function() {
Ti.API.info('beforeload: ' + webView.url);
});
webView.addEventListener('error', function() {
Ti.API.info('error: ' + webView.url);
});
win.add(webView);
var button = Ti.UI.createButton({
title : 'Close',
top : 25,
bottom : 0,
height : Ti.UI.SIZE,
width : 100
});
button.addEventListener('click', function() {
win.remove(webView);
});
webView.add(button);
var url = "https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending";
webView.setUrl(url);
});
win.add(openButton);
win.open();
Attachments
File | Date | Size |
---|---|---|
index.js | 2017-02-10T12:56:17.000+0000 | 1526 |
Hello, I can see the webpage loads fine in SDK 6.0.1.GA in iOS simulator. Please use the GA release.
Hi The setting of request headers is new for a WebView module and will be released in the version 6.1.0. Sorry I could not set the release version 6.1.0. Try it with the latest version 6.1.0.v20170209111025 and see if you could see the request headers set in the landing page. I have a pull request ready to solve the issue. Best regards Christoph
Hello, yes, I was able to reproduce the issue in SDK 6.1.0 master release. Please add the PR. Thanks.
Thanks for h follow-up Christoph, we will take care of it.
QE: Test-cases can be found in TIMOB-24329 and TIMOB-17467, thx!
{noformat} Mac OS Version : 10.12.3 Xcode Version : Xcode 8.2 Build version 8C38 Appc CLI : 6.1.0 Appc NPM : 4.2.9-1 Node : v4.6.0 Device: iPhone 6 (10.2.1) iPhone 5 (9.3.5) {noformat} Using above env passed FR. After merge, the changes are present in SDK
6.1.0.v20170227120704
. *Closing*