JS tab with Ajax via Mios

I am using a js tab to look at some values of a device. I am using Ajax.Request within the js to fetch the relevant data. Works ok when I connect to UI4 within my home network. However, when I look at the tab remotely via mios it fails. Anyone an idea how to get this working (if ever possible).


What exactly fails? Do you get any error message?

at home when I click on the tab I get “Opening XXX …” and the progress bar. Then I have to go to a different tab and when I go back it loads the tab (that seems to be a known issue)

when I connect via mios I get “Opening XXX …” and the progress bar. But in this case no matter what the tab never loads.

Code for the tab is here:

You can see here how it looks when it loads:

I admit I am not a javascript programmer and do not really have a clue what I am doing.

I have exactly the same issue. I believe when you use the remote CP, the UI JS files are served from a MIOS server, not from your Vera. This means that the extra JS files are not available remotely.

Maybe MCV can confirm this - it would be great if this could be changed for UI5?


This was a known issue, but AFAIK it has been fixed months ago. TBH, I’m surprised to hear that this still happens.

Later edit: I tested this and it works, though it takes a little longer to render the tab. What firmware version do you have?

Version is 1.1.1245

I waited quite a bit for the tab to load but it is not happening.

I also have this issue with other js tabs, not only the one I refer to earlier.


Any idea what may go wrong? Is this just with my system and everyone else is fine?


I’ve just tested this again here. If you are just using the JS file that is referenced in the Device.json file for the tab configuration, it works fine for me remotely. The JS loads correctly and content works fine.

However, if you have additional JS files (and other files) that are then referenced from the JS file, then that’s another story. In my dataMine plugin, I use a javascript graphing library, and also have a number of additional PNG images - these aren’t served. That may be because I’ve put them in the wrong place - maybe there’s a better solution? In the absense of any documentation, I put these files in a directory /www/cmh/plugins/dataMine, and I suspect that this content is not loaded remotely when you use mios.com.

I’m using the latest public beta release on my Vera.


Something else to try: Does making an AJAX call with a relative path (…/…/foo/bar) work better than an absolute path (/foo/bar)?

I don’t enable remote access so I haven’t tried personally.


It has nothing to do with AJAX as it seems. I have the same problem with another js tab that does not use AJAX (The google calendar switch)

It seems the browser tries to load https://fwd1.mios.com/sid-XXXXXXXXXXXXXXXXXXXXXXXXX/port_3480/J_Powermax.js which does not work.

In 1.1.1245 the remote loading problem is fixed, so it should work. However, Chris is correct: only the files present in the static Json are loaded.

Actually no custom content is loaded (not even locally), only the files referenced in the static Json or the XML files. The possibility to have custom JS files is a hack, and was added because it was necessary for the Echolabs’ ERGY plugin. There is no support for them in the back-end and everything is done in the UI, that’s why it has issues (actually just one issue and that is the need to click on a tab twice to be rendered).

Edit: @utz: Do you use a browser with FireBug? If that’s the case, can you tell me the HTTP request it makes and if there are any errors in the console?

For me, the AJAX call works fine - it’s the loading of additional files (JS, PNG etc) that doesn’t work. I’m unclear what the path is relative to since the JS file that has the tab code is loaded by some Vera/UI ‘magic’, which is why I chose absolute paths. It might be something worth playing around with though…

I suspect that the MCV model for serving up data remotely is to try and serve from the MiOS server where possible, rather than having to load from the Vera. This does make some sense - MCV probably have a high bandwidth pipe running into their server, and it’s better to serve up content from there rather than having to download it over your ADSL link. The main thing that draws me to that conclusion is for my dataMine plugin I have a new icon which I’ve put into the same place on my Vera as the other icons. This works fine at home, but remotely, I get the X to show the image can’t be found (since it’s being served remotely?).


Chris, for the HomeCare plugin, which has a custom icon, I uploaded the file on a web server (e.g. Imageshack). This way it works even remotely, and it doesn’t need a special installation procedure.

Thanks. I guess this would also work for JS files, although hosting JS files is slightly more difficult than images…

You’re right - I’ve also used a DOM include hack to include the extra JS files. It would be nice if UI5 had support for UI extensions - additional java libraries, images etc. Maybe adding some includes into the json file might allow them to be downloaded remotely as the ‘main’ JS file is currently?


Using firebug it seems to be this request: https://fwd1.mios.com/sid-XXXXXXXXXXXXXXXXXXXXXXXXX/port_3480/J_Powermax.js
(Under Script it says: Reload the page to get source for: https://fwd1.mios.com/sid-XXXXXXXXXXXXXXXXXXXXXXXXX/port_3480/J_Powermax.js thus I assume it does not get this. It does not report an error on the console)

What is the request’s response? Is it something like the image I attached?

Well, I think it does not get to this point. I do not see a request/response for the js tab in the console. (I have not used firebug before, so there is the slight probability I am looking at the wrong windows here …). I get request/response for when I go on the device and look at the first non js panel but nothing happens when going on the js panel then.

To see the request/response open the Net tab in FireBug. Then reload the page and open the problematic tab. You should see something like the attached picture.

Thanks all for pointing me to the right location (I was looking at the script window).

Attached is the view of the request window (minus referer and cookie). I did not attache a picture of the response as this is completely empty (nothing came back).

FWIW, I raised bug 1676 which might resolve this problem if fixed.

Edit: Naah, not related.