Solved

Open New Window from Link In IFrame using HTML Action Link

Posted on 2013-06-28
2
1,207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Part One of the two-part Q&A series with MalwareTech.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

623 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