mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
Two versions of a startup page that will attempt to first load the Welcome
Guide locally (file://) and upon failure will load it from svn.berlios.de. Once either of these files are inserted into browser.jar's content/browser, it can be accessed via chrome://browser/content/<filename>. This will allow BeZillaBrowser to be installed in any location and still be able to access that file. Thanks to Ryan Leavengood and mathewblack for the files!
This commit is contained in:
32
www-client/mozilla-firefox/dynamic-welcome-version1.html
Normal file
32
www-client/mozilla-firefox/dynamic-welcome-version1.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Opening the welcome page...</title>
|
||||
<script type="text/javascript">
|
||||
function fileExists(filename) {
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
} catch (e) {
|
||||
alert("Permission to read file was denied.");
|
||||
}
|
||||
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(
|
||||
Components.interfaces.nsILocalFile);
|
||||
file.initWithPath(filename);
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
var url = "http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk/docs/welcome/welcome.html";
|
||||
var localWelcome = "/boot/system/documentation/welcome/welcome.html";
|
||||
|
||||
if (fileExists(localWelcome))
|
||||
url = "file://" + localWelcome;
|
||||
|
||||
window.open(url, "_self");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
Opening the welcome page...
|
||||
</body>
|
||||
</html>
|
||||
56
www-client/mozilla-firefox/dynamic-welcome-version2.html
Normal file
56
www-client/mozilla-firefox/dynamic-welcome-version2.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta name="robots" content="all" />
|
||||
<title>Welcome to Haiku!</title>
|
||||
<link rel="stylesheet" type="text/css" href="../Haiku-doc.css" />
|
||||
<script type="text/javascript">
|
||||
var xmlhttp;
|
||||
var offLineWelcomePage = 'file:///boot/system/documentation/welcome/welcome.html';
|
||||
var onLineWelcomePage = 'http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk/docs/welcome/welcome.html';
|
||||
|
||||
function redirect()
|
||||
{
|
||||
|
||||
xmlhttp=new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange=state_Change;
|
||||
try
|
||||
{
|
||||
xmlhttp.open("GET",offLineWelcomePage);
|
||||
xmlhttp.send(null);
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
|
||||
window.location = onLineWelcomePage;
|
||||
}
|
||||
}
|
||||
|
||||
function state_Change()
|
||||
{
|
||||
|
||||
if (xmlhttp.readyState==4)
|
||||
{// 4 = "loaded"
|
||||
if (xmlhttp.status==200 ||xmlhttp.status==0)
|
||||
{// 200 = "OK"; loading from file:// so no http status set! hence status == 0.
|
||||
if(xmlhttp.responseText.length != 0)
|
||||
window.location = offLineWelcomePage;
|
||||
else
|
||||
window.location = onLineWelcomePage;
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Problem retrieving data:" + xmlhttp.statusText);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="redirect()">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user