+
+
+
diff --git a/lsp/test_streamembed.html b/lsp/test_streamembed.html
index c10f2694..d950d6b4 100644
--- a/lsp/test_streamembed.html
+++ b/lsp/test_streamembed.html
@@ -14,7 +14,7 @@
var embedtype = $('input[name=force]').val();
var info = document.createElement('script');
- info.src = 'http://'+window.location.hostname+':8080/info_'+streamName+'.js';
+ info.src = 'http://'+(window.location.hostname == '' ? 'localhost' : window.location.hostname)+':8080/info_'+streamName+'.js';
document.getElementById('embedcontainer').appendChild(info);
info.onload = function(){
if (embedtype == '') {
diff --git a/src/embed.js b/src/embed.js
index a556b102..86f569b0 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -1,4 +1,18 @@
function mistembed(streamname) {
+
+ //find the current script
+ var me;
+ if (('currentScript' in document) && (document.currentScript)) {
+ me = document.currentScript;
+ //not supported in old browsers :(
+ }
+ else {
+ var scripts = document.getElementsByTagName('script');
+ me = scripts[scripts.length - 1];
+ //not correct if the script is inserted dynamically, but this is how it used to be
+ }
+
+
// return the current flash version
function flash_version() {
var version = 0;
@@ -201,9 +215,7 @@ function mistembed(streamname) {
}
var video = mistvideo[streamname],
- container = document.createElement('div'),
- scripts = document.getElementsByTagName('script'),
- me = scripts[scripts.length - 1];
+ container = document.createElement('div');
if (me.parentNode.hasAttribute('data-forcetype')) {
var forceType = me.parentNode.getAttribute('data-forcetype');