<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Choose which links in InfoPath Form Web Part open in same window</title><link>https://www.infopathdev.com:443/forums/thread/118015.aspx</link><pubDate>Sun, 07 Jan 2018 21:42:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:118015</guid><dc:creator>qRules is qool</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/118015.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=118015</wfw:commentRss><description>Hey guys,
I published an InfoPath browser form and have it displayed in an InfoPath Form Web Part on a SharePoint 2010 page. The form has a bunch of hyperlinks which by default InfoPath opens in a new window, but I added the code below in a CEWP on the SharePoint page so that all links open in the same window (target = &amp;quot;_self&amp;quot;). My question is, how do I modify the code so that I can choose which links open in the same window, for example I want some links to continue opening in a new window because they are external URLs, while I want URLs to other pages on the SharePoint site to open in the same window, so I need more dynamic code that lets me set only the hyperlinks I choose to open in the same window. Thanks in advance for your help!

Code:


 _spBodyOnLoadFunctionNames.push(&amp;quot;rewriteLinks&amp;quot;);
function rewriteLinks() {
var links = document.getElementsByTagName(&amp;#39;a&amp;#39;);
var len = links.length;
for(var i=0; i[less than symbol]len; i++)
{links[i].target = &amp;quot;_self&amp;quot;;}}</description></item></channel></rss>