I am building a jukebox-like javascript application that runs in the browser. This application will run on a dedicated machine in an exhibition.
It will have to run continuously for 8 hours. At certain moments it will navigate to a different page (or reload current page with different search parameters).
It needs to play audio on all pages. But audio in the browser can only play user-initiated. Is there a way to bypass the user-initiation requirement in chrome or safari? Again, this will be a dedicated machine, so browser flags etc are an option.
If this is not possible in chrome or safari, what would be another solution/environment that can do this?
Your are in total control of the running browser (because you start the kiosk). So you can start the browser without the usual security behavior that prevent auto play.
For example if you are using Google chrome you can start it with chrome.exe --autoplay-policy=no-user-gesture-required
I am developing an app that uses Server Sent Events (SSE - basically one-way websockets). If the user uses the site on their mobile chrome browser and then tabs out for about a minute, the SSE connection breaks. If the user then tabs back into the site, it doesn't refresh the page (this is good). But I still need to re-establish the SSE connection so that the server can resume sending messages to them without a refresh.
I'm trying to debug my implementation but having to do it on mobile is very tedious. I have to grab my phone, refresh the page, then tab out, wait 1 minute (so the connection can break), and then tab back in to determine if my code for re-establishing the connection worked properly.
I would much rather be able to debug this on desktop, but I haven't found a way. I have tried the following:
Tried 5 different Chrome extensions for sleeping a tab. Unfortunately, when you navigate back into the tab it just refreshes the page rather than resumes it.
Tried using USB Debugging, but the desktop keeps the tab open at all times even if you tab out on mobile, so the tab never sleeps.
Tried running debugger; in the Chrome Developer Tools console, but even if I let the Javascript sit with its execution frozen for 5+ minutes, it never breaks the SSE connection, so I can't test if reconnecting works.
Tried using an extension to kill the internet for Chrome, but miraculously, this still maintains the active websocket/SSE connections. Apparently Google engineers have deprioritized this effort?
Basically, I am looking to simulate the behavior that happens on mobile when you tab out of your web browser, wait a minute, and then tab back in (the Javascript execution is frozen, the SSE connection is broken after a minute or so, and then tabbing back in resumes Javascript and attempts to reconnect the SSE connection).
Is this possible?
I think that best change you have by emulating your android device. You can do so by installing android studio from https://developer.android.com/studio and then here you have all you need to start and manage your virtual android env https://developer.android.com/studio/run/managing-avds
This it the way I debug my whole mobile development
The most obvious solution to me would be to attach a listener that tracks the events related to tab activation and build some custom solution upon that.
Simply:
window.onfocus = () => {
// Restore SSE session
};
window.onblur = function () {
// Inactive
};
Just for info, SSE is a different protocol from websockets.
In case you are interested in using websockets implementation, I suggest the following library which works very well in my experience: https://www.npmjs.com/package/#stomp/stompjs
Stomp is an abstraction over the websocket protocol, but it also means you would need to implement this on the server side as well.
You can use the chrome://discards to freeze your tab.
You should close and restore the connection based on the Page LifeCycle events.
You Can Try to use pause execution
goto:
Chrome javascript console (Ctrl+Shift+J) > sources > pause script (press f8)
This simulates like a mobile tab switching so you can debug easily
I think this is the simple and easy solution. thanks
So I've got a page that after it is loaded the Javascript just keeps running and running until I bring up Chrome's Task Manager and kill the tab.
I want to find the memory leak. When I use the Performance tab and stop a recording it'll say "Loading profile..." forever. So I'll kill the tab in Task Manager, but then the profile never loads. Same problem with taking a Heap Snapshot under the Memory Tab.
Is there a way to use the Performance or Memory tabs when I have to kill the tab?
Or do I just have to go "old school" and use console.log() everywhere?
One website I regularly access on my iPad has various JavaScript elements which stop working after around 15 minutes of use (it appears not to be after a set number of actions, if I do one interaction then leave it 15 minutes I have the same problem).
The problem happens on two different iPads on the same network. A fairly old iPad 3 with latest iOS 9.3.5 and a brand new iPad Mini 2 also with latest iOS. If I use mobile internet connection (tethered to my phone) rather than my in-house Wifi I don't have the problem.
The problem doesn't occur on desktop browsers, even when running as an iPad by updating the agent.
The website owners are supposedly investigating, but have said they can't recreate on their mobile test devices. Don't know how hard they have tried mind you!
Originally I though that the only thing that can make the website work again was to switch off and power on again the iPad. Closing the tabs, or the whole browser, or clearing history etc, makes no difference, only powering off and on again. I have more recently figured out that just disconnecting from the network and reconnecting, then reloading the page appears to reload the failing Javascript elements.
Using private browsing until the problem occurs and then closing down the tab, leaving private browsing, and then re-entering has certainly cleared all information as I have to login to the website again, but the problem persists.
So my question is, what could a network do to stop loading javascript parts of a webpage that disconnecting and reconnecting would fix? i.e. what might I have to fix on my home network? If there is any other information I can give, please do let me know.
Chrome Version : 48.0.2564.109 m on Windows 7
We have a Chrome Extension developed for our project.
The extension within it has a video element the source of which is the stream selected from the "chrome.desktopCapture.chooseDesktopMedia". The image for every 500ms is captured as webp from the video played and sent back to the host application via long lived connections.
What we notice is that this extension is crashing after a brief usage in time (sometimes at 5mins sometimes at 30mins). Profiling the extension we see the Heap memory constant at ~2.6MB throughout until the extension getting crashed.
One odd behavior that we noticed is that clicking the "Collect Garbage" button in the Timeline tab of the Developers tool for the extension is helping the extension to run for longer period without getting crashed.
Questions :
1. Is there any existing issue with Google Chrome browser extension's garbage collection not getting triggered until it is manually started ?
2. By any means is it possible to kick start this garbage collection process from the extension's