Jump to content

User:Teraom/hello.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
var myUrl = window.location.href;
alert (myUrl);
if (myUrl.indexOf ("User:") > 0)
	{
		var username = "Some Username";
		alert (username);
		var index1 = myUrl.indexOf ("User:");
		var str1 = myUrl.substring (index1);
		//var index2 = str1.indexOf ("/");
		//var username = str1.substring (0,index2);
		alert (str1); 
	}