Very useful to keep users on your web site
Example
Just add the line
window.open("http://devhelpers.blogspot.ca");Inside a <script> tag
Code snippets for software developers Working source code in C# , Java, Javascript for Android, Windows, Linux
window.open("http://devhelpers.blogspot.ca");Inside a <script> tag
// this code is assumed to run inside an activity class or view // in short, this must have the findViewById method // also, you need the text to be in your string resource file (usually strings.xml) TextView theLabelOnTheScreen = (TextView)this.findViewById(R.id.myLabel); theLabelOnTheScreen.setText(R.string.the_id_of_the_string_to_be_used);
private void downloadFile(string fileUrl) { HttpWebRequest request; request = WebRequest.Create(fileUrl) as HttpWebRequest; // this reduces connection time considerably but it's not supported in windows phone 8 request.Proxy = null; if(request != null) { request.BeginGetResponse(downloadFile, request); } } private void downloadFile(IAsyncResult responseResult) { HttpWebRequest request = responseResult.AsyncState as HttpWebRequest ; if(request != null) { // the using here is VERY important if you don't want leaks using (WebResponse response = request.EndGetResponse(responseResult)) { if(((HttpWebResponse)response).StatusCode == HttpStatusCode.OK) { // if you want to use a dynamic file location, just make the file name a member variable in your class using(FileStream fileStream = File.Open(@"c:\files\my_downloaded.file", FileMode.Create)) { Stream source = response.GetResponseStream(); int bytesRead; byte[] streamBuffer = new byte[1024*64]; while ((bytesRead = source.Read(streamBuffer, 0, streamBuffer.Length)) > 0) { fileStream.Write(streamBuffer, 0, bytesRead); } } } } } }