Solved

Open New Window from Link In IFrame using HTML Action Link

Posted on 2013-06-28
2
1,183 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
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…

734 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