开发者

hyperlink in new window c#

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

<td class="emails-table-cell" colspan="2">
        <asp:Literal ID="BodyLiteral" runat="server" />
        <%
            // *** 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.ReadAllTex开发者_高级运维t(@"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 in separate tabs that is the output i'm looking for.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜