- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2016 08:00 AM
I'm working on building my service portal in Helsinki, and am running into an issue when creating icon links that I'd like to open in a new tab. In older SN versions, there was an option to select how you wanted links to open. That is now gone, and it seems that whatever href code I try to put in the href/html field to open in a new tab doesn't work.
This is specific to widgets in the Portal. Not a UI action.
I believe part of the issue is that it is trying to append the html to the end of the instance url, rather than just opening the link in a new tab.
Has anyone found a way around this, or reported it already as a problem?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2016 09:59 AM
Hi Dan,
Great question. This does not appear to be fully implemented, though it does look like we have most of the code in to get this doen and I think you can get it working with a few changes.
The widget in question, Icon Link, has the following three lines in the HTML template (you can find this by going to the widget editor or the widget record):
3: <a ng-if="::(options.link_template == 'Top Icon' || !options.link_template)" ng-href="{{::data.href}}" class="top_icon {{::options.class_name}}" target="{{::data.target}}">
10: <a ng-if="::(options.link_template == 'Circle Icon')" ng-href="{{::data.href}}" class="circle_icon {{::options.class_name}} text-{{::options.color}}" target="{{::data.target}}">
20: <a ng-if="::(options.link_template == 'Color Box')" ng-href="{{::data.href}}" class="color_box {{::options.class_name}} icon-link-background-{{::options.color}} text-white" target="{{::data.target}}">
These are basic a tags that have some angular calls. What we're interested in is the value of the target attribute as that defines what window you're going to open the link in. The target for all of these is set to data.target which is defined in the Server Script for the widget as follows:
4: data.target = options.target || "";
So we're looking for an option named target and passing its value to the target attribute. If there is no value then we pass an empty string which will use the default behavior - opening in the same tab/window.
For more information on how options work see our documentation on widget options.
Options allow your users to configure individual widget instances. Defining a target option allows you to set the target for each icon link individually if implemented. Here is how I tested enabling this.
1) Open the widget in the widget editor. You can find this by going to /sp_config, clicking widget editor, and searching for "Icon Link".
2) Click the menu icon and click "Clone Icon Link" to create a copy of the widget called "Icon Link with Target". This is necessary because out of box widgets cannot be modified.
3) In the new widget click the menu icon and click "Edit option schema."
4) Click the + icon to add a widget option as follows:
Label: Target
Name: target
Type: Choice
Choices: _blank, _self (These are the two answers that make the most sense. The other two I was able to find were _parent and _top but those are for frames which we're not using here.)
Now when you use "Icon Link with Target" instead of Icon Link you'll see the option to set a target. Setting it to _blank will cause the links to open in a new tab.
Go ahead and test this and make any modifications as necessary. Please note that I've only done some quick testing on my own instance, so you'll want to make sure this is working 100% before moving forward into a production instance.
Thanks,
Gustavo Garcia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2016 09:59 AM
Hi Dan,
Great question. This does not appear to be fully implemented, though it does look like we have most of the code in to get this doen and I think you can get it working with a few changes.
The widget in question, Icon Link, has the following three lines in the HTML template (you can find this by going to the widget editor or the widget record):
3: <a ng-if="::(options.link_template == 'Top Icon' || !options.link_template)" ng-href="{{::data.href}}" class="top_icon {{::options.class_name}}" target="{{::data.target}}">
10: <a ng-if="::(options.link_template == 'Circle Icon')" ng-href="{{::data.href}}" class="circle_icon {{::options.class_name}} text-{{::options.color}}" target="{{::data.target}}">
20: <a ng-if="::(options.link_template == 'Color Box')" ng-href="{{::data.href}}" class="color_box {{::options.class_name}} icon-link-background-{{::options.color}} text-white" target="{{::data.target}}">
These are basic a tags that have some angular calls. What we're interested in is the value of the target attribute as that defines what window you're going to open the link in. The target for all of these is set to data.target which is defined in the Server Script for the widget as follows:
4: data.target = options.target || "";
So we're looking for an option named target and passing its value to the target attribute. If there is no value then we pass an empty string which will use the default behavior - opening in the same tab/window.
For more information on how options work see our documentation on widget options.
Options allow your users to configure individual widget instances. Defining a target option allows you to set the target for each icon link individually if implemented. Here is how I tested enabling this.
1) Open the widget in the widget editor. You can find this by going to /sp_config, clicking widget editor, and searching for "Icon Link".
2) Click the menu icon and click "Clone Icon Link" to create a copy of the widget called "Icon Link with Target". This is necessary because out of box widgets cannot be modified.
3) In the new widget click the menu icon and click "Edit option schema."
4) Click the + icon to add a widget option as follows:
Label: Target
Name: target
Type: Choice
Choices: _blank, _self (These are the two answers that make the most sense. The other two I was able to find were _parent and _top but those are for frames which we're not using here.)
Now when you use "Icon Link with Target" instead of Icon Link you'll see the option to set a target. Setting it to _blank will cause the links to open in a new tab.
Go ahead and test this and make any modifications as necessary. Please note that I've only done some quick testing on my own instance, so you'll want to make sure this is working 100% before moving forward into a production instance.
Thanks,
Gustavo Garcia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2016 08:27 AM
This worked PERFECTLY.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2017 02:24 PM
I agree with Dan, this was a perfect tutorial and should be OOB. Thank you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2017 11:16 PM
This is really helpful but my Chrome and Firefox behave differently when I using this New Widget, Chrome open the link with new tab but Firefox open the link in the same tab. Is this issue due to Firefox or there is setting in Firefox that need to be corrected?