Solved

Open New Window from Link In IFrame using HTML Action Link

Posted on 2013-06-28
2
1,122 Views
Last Modified: 2013-07-07
We are embedding and iFrame in our page which contains links written in Asp.net MVC
frame work. I need to open these links, located in the IFrame in a new window, but
have not been successful with this.
I have tried the following listed below...
But, the links will not break out of the IFrame.        


  <%: Html.ActionLink("Not Registered Yet?", "Register", new { target="_blank" })%>
          <%: Html.ActionLink("Not Registered Yet?", "Register", new { rel="_external" })%>

Thanks
0
Comment
Question by:LT1415
2 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39285993
This code will break you out of an iframe and put your page in place of the parent page but it won't open a new window.  I don't know if you can do both at the same time.
<script type="text/javascript">
<!--
if (top.location!= self.location) {
		top.location = "http://www.yoursite.com/yourpage.html";
	}
//-->
</script>

Open in new window

0
 
LVL 11

Expert Comment

by:lenordiste
ID: 39286680
you could also try to add this to the head section of your iframe:
<base target="_blank" />

Open in new window


this will open all links in a new window. Here is some info:
http://www.w3schools.com/tags/att_base_target.asp

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now