Solved

Open New Window from Link In IFrame using HTML Action Link

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

911 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

15 Experts available now in Live!

Get 1:1 Help Now