M
Mateusz Viste
Hi,
I'm not sure if my question is really related to JavaScript, so please excuse me if that's not the case (and maybe you guys would have an idea what's the cause is and where could I ask)...
I recently put the following script online:
<script type="text/javascript"><!--
function playmedia(mediafile) {
newwindow=window.open();
if (window.focus) {newwindow.focus()}
newwindow.document.write('<html>');
newwindow.document.write(' <head>');
newwindow.document.write(' <title>Media player</title>');
newwindow.document.write(' </head>');
newwindow.document.write(' <body bgcolor="#A0A0FF" text="#000000">');
newwindow.document.write(' <center>');
newwindow.document.write(' <h2>Playing the media file... ♫</h2><br>');
newwindow.document.write(' <!-- show play button, autostart and loop once -->');
newwindow.document.write(' <embed src="' + mediafile + '" hidden=false autostart=true loop=1 autosize=1>');
newwindow.document.write(' </center>');
newwindow.document.write(' </body>');
newwindow.document.write('</html>');
newwindow.document.close();
}
//--></script>
I call this script using the following link:
<a href="errorJS.htm" onclick="playmedia('../goodies/antarcti/antarcti.mid'); return false;">Play</a>
So far, so good: the script is working, and I do not have any problem.
Troubles comes when I want to use my website locally (I often gave an offline copy to my relatives, as they prefer to use it offline). When used from the disk, the browser (Fx) can't find the file. If I change the link from playmedia('../goodies/antarcti/antarcti.mid') to playmedia('goodies/antarcti/antarcti.mid'), then it works offline, but when put on the server I get an 404
I'm using frames, too. The main frame is in / , sub-frames are in /html/ , and the media files are stored in /goodies/. It seems that in some circumstances, the "current" directory isn't the same...
Now the big question comes: Is this some Javascript-related issue? If not, what could be the problem? The browser? My web server?
The website is at http://viste.homeip.net/mateusz/nes
Best regards,
Mateusz Viste
I'm not sure if my question is really related to JavaScript, so please excuse me if that's not the case (and maybe you guys would have an idea what's the cause is and where could I ask)...
I recently put the following script online:
<script type="text/javascript"><!--
function playmedia(mediafile) {
newwindow=window.open();
if (window.focus) {newwindow.focus()}
newwindow.document.write('<html>');
newwindow.document.write(' <head>');
newwindow.document.write(' <title>Media player</title>');
newwindow.document.write(' </head>');
newwindow.document.write(' <body bgcolor="#A0A0FF" text="#000000">');
newwindow.document.write(' <center>');
newwindow.document.write(' <h2>Playing the media file... ♫</h2><br>');
newwindow.document.write(' <!-- show play button, autostart and loop once -->');
newwindow.document.write(' <embed src="' + mediafile + '" hidden=false autostart=true loop=1 autosize=1>');
newwindow.document.write(' </center>');
newwindow.document.write(' </body>');
newwindow.document.write('</html>');
newwindow.document.close();
}
//--></script>
I call this script using the following link:
<a href="errorJS.htm" onclick="playmedia('../goodies/antarcti/antarcti.mid'); return false;">Play</a>
So far, so good: the script is working, and I do not have any problem.
Troubles comes when I want to use my website locally (I often gave an offline copy to my relatives, as they prefer to use it offline). When used from the disk, the browser (Fx) can't find the file. If I change the link from playmedia('../goodies/antarcti/antarcti.mid') to playmedia('goodies/antarcti/antarcti.mid'), then it works offline, but when put on the server I get an 404
I'm using frames, too. The main frame is in / , sub-frames are in /html/ , and the media files are stored in /goodies/. It seems that in some circumstances, the "current" directory isn't the same...
Now the big question comes: Is this some Javascript-related issue? If not, what could be the problem? The browser? My web server?
The website is at http://viste.homeip.net/mateusz/nes
Best regards,
Mateusz Viste