views:

516

answers:

1

I have a variable with hyper links (www.wow.com) like this. I have to pass this value to <a href=""> here in this href tag. My real task is to open this hyper links which will change time by time in my variable, in new tabs. For that I have used javascript in my asp.net web application with c#.

I have used window.location function in js, but its not working correctly. Does any one have an idea to open that hyper links in new window or tabs.

The hyper link value should change as per that variable and should open in new tabs. Can anyone help me to do this

below is a code snippet from my actual code

<% // * Write to file *

            // Specify file, instructions, and privelegdes
            FileStream file = new FileStream("test.html", FileMode.OpenOrCreate, FileAccess.Write);

            // Create a new stream to write to the file
            StreamWriter sw = new StreamWriter(file);

            // Write a string to the file
            sw.Write(BodyLiteral.Text);

            // Close StreamWriter
            sw.Close();

            // Close file
            file.Close();







            var text = File.ReadAllText(@"d:\test.html");

            Regex regex = new Regex("href\\s*=\\s*\"([^\"]*)\"", RegexOptions.IgnoreCase);
            MatchCollection matches = regex.Matches(text);
            //Response.Write(matches);
            foreach (Match match in matches)
            {
                Response.Write(match.Groups[1]);                    
                %>

<% }

%>

i'm getting this from my email that is gmail.

i have accessed my gmail through my web application.

then i have accessed my mail contents.

from that mail contents i have to fetch hyperlinks and show all the links i seperate tabs that is the output i'm looking for

+1  A: 

The basic HTML method of forcing a link to open in a new window is to add a target="_blank" value.

<a href="http://www.wow.com/" target="_blank">Go to WOW</a>

Can you provide a code sample of what you've got so far? It will make it easier to assist.

kdmurray
good answer thanks
tibin mathew