Icontem

File: sample.html

Recommend this page to a friend!
  Classes of Dixan Santiesteban  >  URL info  >  sample.html  >  Download  
File: sample.html
Role: Example script
Content type: text/plain
Description: Sample document
Class: URL info
Parse the current page URL into its components
Author: By
Last change: a little fix
Date: 8 years ago
Size: 1,867 bytes
 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="url.class.js"></script>

<title>URL Info</title>
</head>

<body>
</body>
</html>
<script type="text/javascript">
	var uinfo=new url_info();
	
	if (uinfo.vars.length==0){
		location.href="sample.html?var1=hellou&var2=world#mylabel"; 
	} else {
		document.write("url: <b>"+uinfo.url+"</b> - [<i> full url </i>]<br>");
		document.write("protocol: <b>"+uinfo.protocol+"</b> - [<i> may be http: or https: </i>]<br>");
		document.write("host1: <b>"+uinfo.host1+"</b>- [<i> hostname without protocol </i>]<br>");
		document.write("host: <b>"+uinfo.host+"</b>- [<i> hostname with protocol </i>]<br>");
		document.write("file1: <b>"+uinfo.file1+"</b>- [<i> document name with uri </i>]<br>");
	
		document.write("folders: <b>"+uinfo.folders+"</b>- [<i> folder(s) of script </i>]<br>");
		document.write("script: <b>"+uinfo.script+"</b>- [<i> document name </i>]<br>");
		document.write("uri1: <b>"+uinfo.uri1+"</b>- [<i> full uri</i>]<br>");
		document.write("uri: <b>"+uinfo.uri+"</b>- [<i> uri without label</i>]<br>");
		document.write("label: <b>"+uinfo.label+"</b><hr>");
		
		document.write("var1: <b>"+uinfo.var1+"</b>- [<i> var and value</i>]<br>"); // 
		document.write("var2: <b>"+uinfo.var2+"</b>- [<i> var and value</i>]<br>"); // 

		//////////////////////////////////////////////////////////////////////
		document.write("vars.length: <b>"+uinfo.vars.length+"</b>- [<i> max vars</i>]<br>");
		for (var t=0;t<uinfo.vars.length;++t){
			document.write(""+(t+1)+".- <b>"+uinfo.vars[t].name+"</b> = "+uinfo.vars[t].value+"<br>");
		}
	}
</script>