Voting: 
Vote up!
0 Votes
2 Replies

BrowserWidget rewrite URL

Question asked by Dragos Triteanu on Nov 24, 2015 08:32 EST

Hello Kony, I have a dilema, I want to rewrite the browsers widgets requestData.originalURL so that the browser proceeds to a new URL, but this does not work for me. In the docs I see, that if browser.handleRequest returns false, then the URL from the requestData.originalURL is called. I am trying something like: this.form.brwsrMain.handleRequest = function (browserWidget, requestData) { requestData.originalURL = 'http://www.google.com'; return false; } The actual scope in which we use this, is because the server sends a redirect to an url that it shouldn't, and no more releases are allowed for server side this year, so we have to intercept the url, and rewrite it's path. Thank you! Cheers, Dragos

Vote up!
0 votes
Vote down!

Hi Dragos,

Thank you for contacting forums.

Could you please let us know the platform(Android/iOS/Windows phone/SPA/Desktopweb) and plugin version details(6.0/6.5/5.6)?

Thanks.

Replied by: Dec 02, 2015 05:33 EST
Vote up!
0 votes
Vote down!

Hi,

Just change the requestURLConfig object on your browser widget's instance like so:

frm1.browser1.requestURLConfig = {
  	"URL": "http://wikipedia.org",
  	"requestMethod": constants.BROWSER_REQUEST_METHOD_GET
  };

Note that the new url has to start with "http://"

This works for me on iOS and Android native apps.

Note that on SPA creating a browser widget just opens a new tab in the browser and this won't redirect that new tab -i.e. it won't work.

Replied by: Jan 13, 2016 08:41 EST