Warum willst du das? Was soll das Javascript machen?
Die PHP-Seite per JS einbinden:
<script language="JavaScript" src="http://domain/test.php">
</script>
Inhalt test.php (etwas lang):
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
if (navigator.appName == 'Netscape')
var language = navigator.language;
else
var language = navigator.browserLanguage;
if (language.indexOf('de') > -1) document.write ('Browser-Sprache: Deutsch');
else if (language.indexOf('en') > -1) document.write ('Browser-Sprache: Englisch');
else if (language.indexOf('it') > -1) document.write ('Browser-Sprache: Italienisch');
else
document.write ('Browser weder Deutsch, noch Englisch, noch Italienisch.');
if (navigator.cookieEnabled) cookie = "Cookies: aktiviert";
else cookie = "Cookies: nicht aktiviert";
document.write("<br>" + cookie)
document.write("<br>Auflösung:" + screen.width + " x " + screen.height + "<br>Flash-Version: ")
function isDefined(property) {
return (typeof property != 'undefined');
}
var flashVersion = 0;
function getFlashVersion() {
var latestFlashVersion = 8;
var agent = navigator.userAgent.toLowerCase();
// NS3 needs flashVersion to be a local variable
if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
flashVersion = 0;
}
// NS3+, Opera3+, IE5+ Mac (support plugin array): check for Flash plugin in plugin array
if (navigator.plugins != null && navigator.plugins.length > 0) {
var flashPlugin = navigator.plugins['Shockwave Flash'];
if (typeof flashPlugin == 'object') {
for (var i = latestFlashVersion; i >= 3; i--) {
if (flashPlugin.description.indexOf(i + '.') != -1) {
flashVersion = i;
break;
}
}
}
}
// IE4+ Win32: attempt to create an ActiveX object using VBScript
else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
var doc = '<scr' + 'ipt language="VBScript"> \n';
doc += 'On Error Resume Next \n';
doc += 'Dim obFlash \n';
doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
doc += ' Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
doc += ' If IsObject(obFlash) Then \n';
doc += ' flashVersion = i \n';
doc += ' Exit For \n';
doc += ' End If \n';
doc += 'Next \n';
doc += '</scr' + 'ipt> \n';
document.write(doc);
}
// WebTV 2.5 supports flash 3
else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;
// older WebTV supports flash 2
else if (agent.indexOf("webtv") != -1) flashVersion = 2;
// Can't detect in all other cases
else {
flashVersion = flashVersion_DONTKNOW;
}
return flashVersion;
}
flashVersion_DONTKNOW = -1;
//<![CDATA[
var requiredVersion = 5;
var flashVersion = getFlashVersion();
if (flashVersion >= requiredVersion) {
document.write('<p>You have Flash ' + flashVersion + ' installed on the current browser.</p>');
}
else if (flashVersion > 0) {
document.write('<p>The version of Flash installed on the current browser is ' + flashVersion + '.</p>');
}
else if (flashVersion == 0) {
document.write('<p>You don't have Flash installed on the current browser.</p>');
}
else if (flashVersion == flashVersion_DONTKNOW || flashVersion == null) {
document.write('<p>This browser does not support Javascript-based Flash detection.</p>');
}
//]]>
document.write("Farben: " + screen.colorDepth + " Bit");
</SCRIPT>
<?php
echo "<br>Browser: {$_SERVER['HTTP_USER_AGENT']}";
?>
Klappt aber nicht... sollte aber so gehen :( Oder hab ich was übersehen?