JSLink to Modify URL to open in new Window

I'm trying to write a javascript to open a URL in a new window. I'm not the best at javascript and can't seem to get the URL formatted correctly.  Here is my example:
(function () {
// Initialize the variables for overrides objects
var overrideCtx = {};
overrideCtx.Templates = {};
// alert("Override call worked");
// Use BaseViewID and ListTemplateType to narrow focus/scope on
// which web parts on the page are affected
// overrideCtx.BaseViewID = 1;
// overrideCtx.ListTemplateType = 100;
* Using the Fields override leaves the rest of the rendering intact, but
* allows control over one or more specific fields in the existing view
overrideCtx.Templates.Fields = {
//'LinkLocation': { 'View' : 'Animal' }
//'LinkLocation': { 'View' : '<b><#=ctx.CurrentItem.LinkLocation#></b>'}
//'LinkLocation': { 'View' : '<a href=ctx.CurrentItem.LinkLocation><#=ctx.CurrentItem.LinkLocation#></a>'}
'LinkLocation': { 'View' : '<div><a href=""ctx.CurrentItem.LinkLocation""><#=ctx.CurrentItem.LinkLocation#></a><div>'}
* Register the template overrides.
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
I'm not sure how to put the quotations around the hyperlink.  When I do get it sort of working it puts "ctx.CurrentItem.LinkLocation" in as the path along with the local hostname. 
Can someone tell me what I'm doing wrong?
David Jenkins

Getting closer.  I moved into a function.  Of course I'm missing something.  I can't seem to get two Field to work together in the function.  I'm sure it's because I'm calling the function on just the one URL and not the title. 
I wanted to overwrite the URL's name with the title field.
(function () {
// Initialize the variables for overrides objects
var overrideCtx = {};
overrideCtx.Templates = {};
// alert("Override call worked");
//Functions
function OpenURL(ctx) {
//'<b><#=ctx.CurrentItem.LinkLocation#></b>'
//var LinkURL = ctx.CurrentItem.LinkLocation;
//var LinkTitle = ctx.CurrentItem.Title;
var ret;
ret = '<a href=' + ctx.CurrentItem.LinkLocation + ' target=\'_blank\' >' + ctx.CurrentItem.LinkLocation + '</a>';
//ret = 'test'
return ret;
// Use BaseViewID and ListTemplateType to narrow focus/scope on
// which web parts on the page are affected
// overrideCtx.BaseViewID = 1;
// overrideCtx.ListTemplateType = 100;
* Using the Fields override leaves the rest of the rendering intact, but
* allows control over one or more specific fields in the existing view
overrideCtx.Templates.Fields = {
//'LinkLocation': { 'View' : '<b><#=ctx.CurrentItem.LinkLocation#></b>' }
//'LinkLocation': { 'View' : '<b><#=ctx.CurrentItem.LinkLocation#></b>' }
//Overwrite title
//'Title': { 'View' : '<#=ctx.CurrentItem.Title#>' },
'Title': { 'View' : '<b><#=ctx.CurrentItem.Title#></b>' } ,
//'LinkLocation': { 'View' : '<b><#=ctx.CurrentItem.Title#></b>' }
'LinkLocation': { 'View' : OpenURL }
* Register the template overrides.
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
David Jenkins

Similar Messages

  • URL iview opening in new window problem

    Hi All,
    I am using customized top level navigation (developed using byEPCM method).
    I  created URL iview and pointed "http://www.google.com" . (Launch in New Window = Displaly in sepearte window)  .I have assigned this  iview to a role as delta link. When naigating this iview, it is opening in new window. But it is showing "Permission Denied script error". And also, it is not displaying url as "http://www.google.com" .
    If I navigate via standard top level navigation, it is working fine. Please help to solve this problem.
    Thanks,
    Venkatesh R

    Hi,
    Check authentication related properties of iView. Make sure all of them are set to lowest level or none
    Regards,
    Ganga

  • URL iView - Open in new window - User Action Independent

    Hello Experts,
    What has been configured:
    I have built an I URL iview and set its paramater to open in a new window. I have assigned the iview to a role. I have also assigned a quicklink to the iview
    Name: xyz
    quick link: xyz
    quick link url: https://<domain>/irj/portal/xyz
    What has been tested:
    When I log in to the portal using the test user ID and click (user action) on xyz the destination URL pops up in a new window as expected.
    When I access the iview via the quick link it loads the destination URL in the same portal window (no pop up)
    What do I need:
    We will be using the quick link to get to SAP portal from another legacy portal and I want to hit the target URL as soon as I access the quick link without being taken to the portal page in which the target URL content is rendered. I also do not want to have the user click on the/a link to navigate to the target URL.
    Things as they stand:
    The destination URL is hitting a standalone WD ABAP object which is not hosted in SAP portal content. The SAP portal has to be used because the logon ticket issued by the portal is also used to login to the server hosting the WD ABAP.
    Please let me know if you think this is something that can be achieved.
    Many thanks,
    Prashanth

    Hi,
    2. It is not possible to hide it completely or disable it. Give this a try:
    Create a Static HTML page and create a link in that which will take you to quick link page/iview.
    or you can create a custom application which will call the application underlying the quicklink on click of a link.
    3.  For removing the History, Back and Forwards links in Page Title Bar, follow the below:
    In Portal navigate to Content Administration - Portal Content - Content Provided by SAP - End User Content - Standard Portal Users - Open the Default Framework Page
    With the Framework Page - you will find Page Title Bar iView - Open the iview and go to iView Property
    Show Back/Forward Links and Show History List by default this setting is set to Yes. change teh setting to No and you will not be seeing those in the page title bar.
    NOTE: If you make this change it is applicable to all other pages and iViews. So be cautious before making the change.
    Hope this helps.
    cheers-
    Pramod

  • Targer URL not opening in New Window

    I have built a report with URLs. The report works well, but the Detail report is opening up in main window (overwriting master report containing URLs). I have checked the property 'Open Links in New Window' in Master report, but still the same. Does anyone have any ideas if iam missing anything here.
    Thanks

    Thanks for responding to my post. I have tried to implement as you said, but as you mentioned the solution worked only in HTML. (Master report HTML and Detail report PDF). But, i was looking for solution where the Master report is PDF and Detail is also PDF. If both are PDFs the detail report is overwriting master report output in same window.
    Do you have an idea if this is possible in BIP.
    Thank You.

  • Action Script 3 URL  link opens in new window

    How do I stop the url link in the following code from opening
    a new browser window?
    thank you

    When I do this it comes through as an action scrip error.
    var link = new URLRequest("
    http://rhr-standout.com/pages/destination_finder/index.html","_self");
    button_mc.addEventListener(MouseEvent.CLICK, onClick);
    function onClick(MouseEvent):void
    navigateToURL(link);
    button_mc.buttonMode = true;

  • URL not opening in new window

    Hi Gurus,
    I am stucked in a problem related to Portal. I am developing a portal page under which many Links with URL's will be listed. I want all the URL's should be opened in a separate window.
    I am unable to do so.
    Appreciate any quick help on this,
    Thank you
    Raj

    If you are creating the links with html (not using URL items) then just include target="_blank" in your link like <a href="#" target="_blank">your link</a> to open a link in a new browser window. If you are adding links to the page using URL items, then check the option to show the link in a new browser window. Note: if you are using an HTML Content Layout template and have applied it to the item region where you are publishing your URL items, then you will need to include conditional statements in the template to check for that (e.g. open link in new browser window) and include the correct target for the link based on what was selected for that item.

  • How do I open a new window (cmd + N) on the current page (url) NOT my homepage?

    Before I updated to firefox 28, I was able to hit cmd + N and it would open a new window with the exact same webpage I was on. Now it opens a new window with my homepage. I'm assuming I had an add-on or extension, but I am desperate to be able to do this again. Ideas?

    This is an oversight by the developers of the latest FireFox revision: a great shame, as the overall feel of the browser has patently been improved.
    Xabolcs has come up with a nice fudging idea; if it were to work; but sadly it doesn't for me....
    As mentioned by MGprof, the latest version of FireFox (May'14) now opens one's "homepage" instead of a new blank window.
    As my "homepage" is almost a dozen tabs; this is worse than useless. It's like starting FireFox again; and then having to close a whole string of unwanted tabs!
    To compound my frustration, the "move to a new window" option disappeared on another recent FireFox "upgrade"; but I managed to get round that by copying an url from a tab, then opening a new blank window, to paste the url into.
    So, is there any possible way to open a new window in this latest version of FireFox?
    I just want to be able to open a new FireFox window; and I'd be happy with it being either blank, or duplicating the url of a currently-showing tab.
    This would allow view of one trimmed-size webpage in front of another one, showing in a selected tab in my normal-use multi-tab window: useful when comparing complex images, for example.
    I have just installed the above-recommended "duplicate-2-window"; but can't make it work for me.
    I've assumed "no-restart-necessary" claim is correct; but using cntrl+N, I now get a new blank TAB!
    I'll try rebooting next, and post here again if that improves the situation; but don't hold your breath!
    Meanwhile, if the developers are watching out for feedback..................................... please sort this, by putting back the "open a new window" option: I do NOT want to have to use Gugl-Krohm!

  • How do I Open a New Window to the Same URL?

    When I click CTRL-N to open a new WINDOW, is there a way to have that new window open to the SAME URL as the one I was on (instead of opening to my Home Page)?

    Hi jpeg,
    Not exactly what you want but it may help.
    You can right click a link or middle click it to open in a new tab, so that is an indirect method of duplicating a tab.
    *[[Keyboard shortcuts - Perform common Firefox tasks quickly]]
    *[[Use mouse shortcuts to perform common tasks in Firefox]]
    A more direct method is to drag a tab with a Ctrl + Left Click
    Alt+Enter creates a new tab from the search or address bar.
    It is possible to customise the newtab page. It is even possible to set it to any chosen URL, but I am not aware of a method of setting it a dynamic tab in current focus, which is what you may wish for.
    * [[New Tab Page – show, hide and customize top sites]]

  • List-Items (Type=URL) - how to open in New Window

    I use a List for deliver information in a region.
    The list consist of some URLs.
    I would like to open a new Window (not use the active Window), if one element was clicked.
    With html-text-region I could user "target=...", but this is not usable in the List entries, it should be a simple URL.
    Have we any attributes for such a behavior?

    Lutz,
    You can achieve what you want in a list template. For example the sample application uses the following fragment in the Standard Unordered List template:
    <li>#TEXT#</li>
    Simple change that to
    <li><a target="new" href="#LINK#" style="font-weight:bold;" class="list">#TEXT#</a></li>
    or something similar.
    Sergio

  • Open URL Ivew in a new window without loosing the current session in Portal

    Hi All ,
    I have a requirement in which there are two tabs in portal which are two roles A and B
    Where each tabs(role) has an URL Iview attached to it.
    Current I am in Window 1 - Tab A
    When I click on Tab B, it has to open in a new window (Window2) with Tab B content , where as the previous session (Window1)is not lost and Window1 has to show Tab A only.
    Kindly help me out on how to implement it .
    Thanks in Advance

    Hi All ,
    Thanks for the reply and sorry for the late response. 
    As per Prashant  I made the setting .. When I click Tab 2 in Window 1,  opens  a new window 2 with Tab 2 iview .but the window 1 is hilighted with Tab B and the current session on Tab A is lost . As per the reqiirement I should not loose the focus on Tab A in Window1.
    also Kindly let me know how and where can I sent the EPCM paramenter for the URL Iview .
    Thanks in Advance
    Edited by: Prasanna Kumar on Feb 21, 2012 12:42 PM

  • When i type a url, it open this url every time "chrome://browser/content/browser.xul" and it open the new window in a tab. Please help

    or when i tri google search, this url is automatically open and open a new window inside a tab.

    Do you have that problem when running in the Firefox SafeMode?<br/> ''A troubleshooting mode.''<br />
    You can open the Firefox 4.0 SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut. Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut to open it again.''
    If not, see this: <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes

  • URL Iview is not open a new Window in FireFox

    Hi Guys,
    After we upgrade our portal to NW 7.0 EHp2 SP6 , we can not open the URL Iviews in Firefox.
    It looks like can't force the iview to open a new window and instead it open a new tab , Any suggestion?
    Thanks,

    Hi Mar,
    To me, the PAM mentioned Firefox 3.5 is not recommended for NW 7.0 Ehp2 - Firefox 3.6 is supported for NW 7.0 Ehp2 starting with SPS6.
    Anyway, if it works in IE & Safari, I don't think it has anything to do with the portal; it's something in Firefox settings.  As mentioned before, did you check the option to open new links in new windows? Also, please checkSAP Note 1296463 and its related notes about browsers to see if there's something relevant to your case.
    Regards,
    Dao

  • How can I force a popup to open in a new tab instead of opening a new window?

    I want to keep any links that I click from opening a new window, ie. if I click on a link in an open tab that opens a new window, I want it to open in a new tab instead. I am on Firefox 5.0.

    You can look at the browser.link.open_newwindow prefs on the about:config page.
    * http://kb.mozillazine.org/browser.link.open_newwindow.restriction (0)
    * http://kb.mozillazine.org/browser.link.open_newwindow (3)
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    *Use the Filter bar at to top of the about:config page to locate a preference more easily.
    *Preferences that have been modified show as bold(user set).
    *Preferences can be reset to the default or changed via the right-click context menu.

  • Open a new window when you click on a button

    Hi all,
    I'm a newbie on BPS and web interface on BPS. I have a problem on how to open a new window.
    I explain:
    We have a page with a button which call a function. We want to change this button in the way when you ckick it, a new window appears and present a page with two buttons which call each a function(this page is already created thanks to bps_wb).
    The problem is : how to modify the button in the way it opens a new window with in parameter the page.
    Thanks by advance.
    Best regards,
    Nicolas

    Hi Nicolas,
    I don't know about a pop-up, but if you are trying to open a page (page 2) in a new window (internet explorer window), then do the following:
    Instead of using a navigate pushbutton, use a hyperlink component.
    In the URL selection option insert the URL (web address) of page 2. You can find the URL by going to SE80, in the repository browser select "BSP Application" and "THE TECHNICAL NAME OF YOUR BPS". Open your BSP and go to the folder "pages with flow logic" and find your "page 2". Double click on your page and then select the "properties" tab and navigate to the bottom where you will see the pages URL.
    Insert this URL address into your hyperlink component back in the Web Interface Builder.
    Leave the Target selection as parent. Make sure your internet explorer enhanced options are set to "not reuse the same window" under the browser options.
    Good luck.
    Rael

  • Firefox shows wrong page when application opens a new window

    Only fails since V4.0.0 installed.
    pages that open a new window using window.open(url) sometimes produce a page from cache instead of the page to be loaded. This seems erratic. Often, failure starts after a popup window loads and is closed, then attempts to open a different popup will produce the first page contents (or the default home page) instead of the page requested. Seems as tho there is a bug in FF determination of whether to fetch page from cache or new. Tried setting '''browser.cache.check_doc_frequency''' to 1 and while that seemed to help, it did not resolve all the errant behavior.

    To restore the original behavior, you could try removing the explicit site-specific permission by deleting the site from this dialog:
    orange Firefox button (or Tools menu) > Options > Content > "Exceptions" button to the right of Block pop-up windows
    Does that work?
    Also, I don't recognize this part:
    ''At the bottom of the window would be the URL address(es) of the popup page(s), so that if I wanted to access a page, I could simply click on the address and a new tab would open with the new page.''
    Oh, wait a minute, I just reviewed your "More system details" list again and it appears that you have a custom pop-up handler:
    * Extension: Adblock Plus Pop-up Addon 0.7
    * Modified setting: privacy.popups.showBrowserMessage: False
    So if the above reset doesn't resolve it, you might need to review the add-on's settings in case it has its own list.

Maybe you are looking for

  • Testing server no longer working

    Hi All, I recently upgraded the hard drive in my macbook pro and used time machine to copy all data to the new drive. Now my testing server (MAMP) is no longer working. When I point my browser to /localhost/ the index page comes up but none of the dy

  • System.out will not flush before input

    Hello everyone, I am using Netbeans 5.5, JDK6, and J2EE. I am new to the environment so I wrote a test application that would prompt a user to enter a string and then echo it. I have: String str = ""; BufferedReader br = new BufferedReader(new nputSt

  • Is there such a thing as a 2mm (female) to 3.5mm (...

    I'd like to use my new 2mm phone chargers (one in the car and one at home) to charge both my new nokia and my old 'emergency phone' (an 8310). Can anyone tell me if it is possible to find a 2mm (female) to 3.5mm (male) adapter? and if so where? Thank

  • Firefox can't forget a tab; clear history never blank.

    Hello. My Firefox browser is patched to latest version; the problem is that Firefox can't forget one specific tab. Whenever I clear all history it asks about that tab on next start. Cleaning with Auslogics Browser Care doesn't help at all. Though, it

  • OADP-NAvigation rule customisation

    hey all, our requiremnt is to hide org units that appear in the tree structure on the ECM portal Iviews. they are hidden if the org units do not have A012 (heads) we hae tried the badi hrwpc_nav _objects and custom rule for nav objects.. when tried t