少しグーグルで考えた後、私は決断しました:ユーザーが
したがって、直接実装:
index.html-メイン
< html >
< head >
< title > </ title >
< script >
function openPage()
{
var newwin = window.open( 'bgsound.html' , 'ert' , 'scrollbars=0, resizable=0, titlebar=1, height=20, width=320' );
newwin.blur(); //
}
</ script >
</ head >
< body onload ="openPage()" >
< a href ="otherpage.html" > , ? </ a >
</ body >
</ html >
* This source code was highlighted with Source Code Highlighter .
< html >
< head >
< title > </ title >
< script >
function openPage()
{
var newwin = window.open( 'bgsound.html' , 'ert' , 'scrollbars=0, resizable=0, titlebar=1, height=20, width=320' );
newwin.blur(); //
}
</ script >
</ head >
< body onload ="openPage()" >
< a href ="otherpage.html" > , ? </ a >
</ body >
</ html >
* This source code was highlighted with Source Code Highlighter .
< html >
< head >
< title > </ title >
< script >
function openPage()
{
var newwin = window.open( 'bgsound.html' , 'ert' , 'scrollbars=0, resizable=0, titlebar=1, height=20, width=320' );
newwin.blur(); //
}
</ script >
</ head >
< body onload ="openPage()" >
< a href ="otherpage.html" > , ? </ a >
</ body >
</ html >
* This source code was highlighted with Source Code Highlighter .
bgsoung.html-バックグラウンドミュージックのページ
< html >
< head >
< title > ( ) </ title >
< script >
<!--
function player()
{
//
var isWin = navigator.userAgent.toLowerCase().indexOf( "windows" ) != -1;
if (isWin)
{
visitorOS= "Windows" ;
}
else
{
visitorOS= "Other" ;
}
var objTypeTag = "application/x-mplayer2" ; // Windows
if (visitorOS != "Windows" ) { objTypeTag = "audio/mpeg" }; //
document .writeln( "<object data='sound.mp3' type='" + objTypeTag + "'>" );
document .writeln( "<param name='filename' value='sound.mp3' />" );
document .writeln( "<param name='autoplay' value='true'>" );
document .writeln( "<param name='playcount' value='0'>" );
document .writeln( "</object>" );
document .close();
}
// -->
</ script >
</ head >
< body >
< script >
player();
</ script >
</ body >
</ html >
* This source code was highlighted with Source Code Highlighter .
< html >
< head >
< title > ( ) </ title >
< script >
<!--
function player()
{
//
var isWin = navigator.userAgent.toLowerCase().indexOf( "windows" ) != -1;
if (isWin)
{
visitorOS= "Windows" ;
}
else
{
visitorOS= "Other" ;
}
var objTypeTag = "application/x-mplayer2" ; // Windows
if (visitorOS != "Windows" ) { objTypeTag = "audio/mpeg" }; //
document .writeln( "<object data='sound.mp3' type='" + objTypeTag + "'>" );
document .writeln( "<param name='filename' value='sound.mp3' />" );
document .writeln( "<param name='autoplay' value='true'>" );
document .writeln( "<param name='playcount' value='0'>" );
document .writeln( "</object>" );
document .close();
}
// -->
</ script >
</ head >
< body >
< script >
player();
</ script >
</ body >
</ html >
* This source code was highlighted with Source Code Highlighter .
otherpage.html-他のページ
< html >
< head >
< title > </ title >
</ head >
< body >
!
< a href ="index.html" > ? </ a >
</ body >
</ html >
* This source code was highlighted with Source Code Highlighter .
< html >
< head >
< title > </ title >
</ head >
< body >
!
< a href ="index.html" > ? </ a >
</ body >
</ html >
* This source code was highlighted with Source Code Highlighter .
UPD
ユーザーの許可なしに音楽(音)を含めるのは非現実的であるという事実に注目します。