Author Topic: How to add an unsupported browser  (Read 5255 times)

Offline jeffshead

  • Full Member
  • ***
  • Posts: 71
How to add an unsupported browser
« on: November 05, 2013, 08:43:33 PM »
I use several different devices and browsers to access RoundCube. All of them work just fine with RC but I have to spoof some of the browsers' user agents to avoid triggering the "Your browser does not suit the requirements for this application" error that hides the login form.

How can I add specific user agents to Roundcube so they do not trigger this error?

I searched the code and tried a couple of things but I was not able to get anything to work.

Can someone please tell me which files and what code needs to be edited?

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,543
    • http://SKaero.com/
Re: How to add an unsupported browser
« Reply #1 on: November 05, 2013, 10:29:03 PM »
To my knowledge RoundCube doesn't check for specific browsers/versions are you using any plugins?

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
Re: How to add an unsupported browser
« Reply #2 on: November 05, 2013, 10:49:59 PM »
Are you talking about the javascript warning? If so, and the browser you are trying does have javascript support, then you need to coax the browser to report that it truly is javascript-capable. That's not a roundcube thing, its the browser.
« Last Edit: November 05, 2013, 10:51:58 PM by ABerglund »
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline jeffshead

  • Full Member
  • ***
  • Posts: 71
Re: How to add an unsupported browser
« Reply #3 on: November 05, 2013, 10:58:47 PM »
To my knowledge RoundCube doesn't check for specific browsers/versions are you using any plugins?

Thanks for replying  :)

I'm using the jqueryui and contextmenu plugins but I get the same results after disabling them and clearing the browser's cache.

There are some files that do check the user agent and generate the error.

As far as I can tell, the files below handle the checking and errors but my mods did not work:

..\program\lib\Roundcube\rcube_browser.php
..\program\steps\utils\error.inc
..\program\include\rcmail_output_html.php

Offline jeffshead

  • Full Member
  • ***
  • Posts: 71
Re: How to add an unsupported browser
« Reply #4 on: November 05, 2013, 11:09:38 PM »
Are you talking about the javascript warning? If so, and the browser you are trying does have javascript support, then you need to coax the browser to report that it truly is javascript-capable. That's not a roundcube thing, its the browser.

This particular error does not have anything to do with JavaScript support. It has to do with the user agent. RC does check the user agent and notifies the user if the browser is not supported.

Below is a screen cap:

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,543
    • http://SKaero.com/
Re: How to add an unsupported browser
« Reply #5 on: November 05, 2013, 11:35:38 PM »
I've never seen that error, even when using obscure browsers. I also can't find any of the text in that error message in any of the RoundCube language files. I also noticed that the error message says it that it requires IE 7+ but RoundCube officially support IE 6 so I don't see how it would coming from RoundCube.

Offline jeffshead

  • Full Member
  • ***
  • Posts: 71
Re: How to add an unsupported browser
« Reply #6 on: November 05, 2013, 11:42:12 PM »
I've never seen that error, even when using obscure browsers. I also can't find any of the text in that error message in any of the RoundCube language files. I also noticed that the error message says it that it requires IE 7+ but RoundCube officially support IE 6 so I don't see how it would coming from RoundCube.
The text for the error is located in the following file:
..\program\steps\utils\error.inc

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,543
    • http://SKaero.com/
Re: How to add an unsupported browser
« Reply #7 on: November 06, 2013, 01:28:40 AM »
Interesting it is indeed there, its very odd that I've never run across it before. Tracking back the code it doesn't look like its actually check for browser versions, the code that triggers the error is in the app.js:
Code: [Select]
// check browser
if (!bw.dom || !bw.xmlhttp_test() || (bw.mz && bw.vendver < 1.9)) {
  this.goto_url('error', '_code=0x199');
  return;
}

There are three checks, first "!bw.dom" That checks a variable in the common.js file which checks for the ability to select an element by id.
Code: [Select]
this.dom = document.getElementById ? true : false;

The second check "!bw.xmlhttp_test()" calls the xmlhttp_test() function also in the common.js file to check for XMLHTTP support.
Code: [Select]
// test for XMLHTTP support
this.xmlhttp_test = function()
{
  var activeX_test = new Function("try{var o=new ActiveXObject('Microsoft.XMLHTTP');return true;}catch(err){return false;}");
  this.xmlhttp = (window.XMLHttpRequest || (window.ActiveXObject && activeX_test()));
  return this.xmlhttp;
};

The third check "(bw.mz && bw.vendver < 1.9)" checks if you are running Mozilla and that the version is less than 1.9.

I'm not sure which check is causing it to break for you though, what browser are you using?
« Last Edit: November 06, 2013, 01:36:50 AM by SKaero »

Offline jeffshead

  • Full Member
  • ***
  • Posts: 71
Re: How to add an unsupported browser
« Reply #8 on: November 06, 2013, 07:24:47 AM »
I'm not sure which check is causing it to break for you though, what browser are you using?

Thank you so much for taking the time to find the actual check.

The browser I use the most is Firefox 25 with the following custom user agent which triggers that error:

Mozilla/5.0 (en-us;)

I have to use that specific user agent from one location.

It's the third check that causes the trigger for that user agent.
« Last Edit: November 06, 2013, 07:33:11 AM by jeffshead »

Offline alec

  • Hero Member
  • *****
  • Posts: 1,154
Re: How to add an unsupported browser
« Reply #9 on: November 06, 2013, 07:45:07 AM »
Change it to "Mozilla/5.0 (en-us; rv:25.0)" and it should work.

Offline jeffshead

  • Full Member
  • ***
  • Posts: 71
Re: How to add an unsupported browser
« Reply #10 on: November 06, 2013, 06:07:59 PM »
Change it to "Mozilla/5.0 (en-us; rv:25.0)" and it should work.

Thanks :)

That works for RC. Now I have to wait till tomorrow and test the new user agent from the other location and make sure it does not cause any issues.