Habpanel on an Android using a Frame widget with Javascript inside the HTML

Tags: #<Tag:0x00007f616f649420> #<Tag:0x00007f616f649150>

I’m running OH 2.4

I have discovered an issue with Habpanel on an Android and Chrome using a Frame Widget with Javascript inside the HTML. I have a panel with a frame widget that is referencing this HTML code below and after X hours, the entire Habpanel instance using Chrome gets a Aw Snap error. It’s usually between 4 - 12 hours when it happens. My panels rotate every 2 minutes. I’ve changed the options with in the Javascript from refreshing every 5 minutes to every 60 minutes but that didn’t help either.

Part of me believes this Javascript is running all the time even when the Habpanel page isn’t being displayed. The count down timer (60 minutes) never starts over it’s just continue all the time even though the panel isn’t being displayed.

This is a 3rd party Javascript Widget so I don’t have control of it.

It’s definitely this HTML code because I have excluded it from the rotation and it doesn’t happen when it’s excluded. I’ve tried numerous attempts in trying to catch the JavaScript error and reload the page w/o any success.

Does anybody have any HTML/Javascript code (or widget) I could put on the panel that would catch an error and reload the panel OR restart the Habpanel instance itself when the panel fails?

Attached is the HTML; couldn’t insert it inline.iframe xfer.txt (1.3 KB)

Best, Jay

I can’t help with your specific problem but since this isn’t itself a solution or tutorial I’ve moved it to a more appropriate category.

You can not put javascript into a widget directly like that, you need to lazy load it. More info in the main threads on how to get started with creating a custom widget.

I reviewed these examples below - none of them are pulling in 3rd party Javascript. Kind of at a lost here.

Advanced: Injecting custom JavaScript code

You can use the oc-lazy-load directive to inject additional JavaScript (and CSS) files, provided they are deployed on the same server as HABPanel (typically under /static ), even AngularJS directives and controllers.

See these posts for examples: 1 , 2 , 3 , 4 , 5

Best, Jay

Don’t you get an error code along this “Aw Snap” message? Those are usually out-of-memory errors.

Yes, and it starts between 4 - 8 hours when I added this specific panel to the rotation. I’m running on a Android Tablet A10.1 with 16 GB of RAM. I have to kill Chrome and restart Habpanel over again.

I wish I knew a way to have the Javascript unload itself from memory when it’s NOT being displayed. I believe HabPanel is keeping it (Javascript) running when the panel isn’t displayed after the first display of it. The reason I feel this is because there is a counter that JavaScript uses to refresh itself (set to 60 minutes and it’s visible counting down) and when it rotates to that specific panel the 2nd time, it’s not starting at 60 - it’s starting somewhere between 0 - 60 which means it’s running when it’s not being displayed.

Best, Jay