HitCounterGui.html does not update when using http url from remote machine.
hooddanielc opened this issue · 3 comments
Describe the bug
OBS browser does not update when using http
url (ex. http://192.168.169.69:8800/Designs/HitCounterGui.html because chromium embedded framework caches http responses.
To Reproduce
Steps to reproduce the behavior:
- Launch static http server serving static files where root path point to directory containing
Designs
folder. - Launch latest obs on linux with obs-browser plugin installed
- Display the browser source in the scene
Expected behavior
The page is updated when the iframe is reloaded.
Additional context
I was able to fix this issue by changing
iframe.src = '../HitCounter.html';
to call a hardRefreshIframe()
function
hardRefreshIframe();
definition of hardRefreshIframe
var iframe;
function hardRefreshIframe() {
if (!iframe) {
iframe = document.getElementsByTagName('iframe')[0];
}
if (iframe.contentWindow.location.href.indexOf('HitCounter.html') >= 0) {
// force hard refresh
iframe.contentWindow.location.reload(true);
} else {
iframe.src = '../HitCounter.html';
}
}
I can make a pr if that is ok. Also would like to know where the change should be made.
Hi, I need to check first if this works in most common browsers or have you checked that already?
I'm testing on Opera, Firefox, InternetExplorer, Edge, Chrome and I also check TwitchStudio, OBS, OBS Studio and StreamLabs.
I also thought, if it might be better to use meta tags in order to disable caching as when the tag is unknown it will be ignored, but if javascript is not known it most likey crashes/breaks the whole thing.
I agree javascript change is risky. The only api that might not have much support is the window.location.reload
api, which is available on caniuse.com's support tables it's supported on all browsers except the ones that it has not checked, which appear to be mobile browsers.... Opera Mini
, UC Browser for Android
, QQ Browser
, Baidu Browser
, KaiOS Browser
looks like it is supported on IE6 too. The support tables for location.href
are the same