The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Launch a separate web browser from a menu item.
Posted: 12 Apr 12 2:33 PM
|
fiogf49gjkf0d
Hi all,
We are using SalesLogix web version 7.5.4.
I have been tasked with launching a new web browser window (outside of SLX) from a menu item. For the life of me I cannot seem to make it work.
I can cause the SLX web to redirect to my new web site. But I cannot get a new browser window to 'pop' up.
Any ideas?
|
|
|
|
Re: Launch a separate web browser from a menu item.
Posted: 12 Apr 12 3:08 PM
|
fiogf49gjkf0d Are you using a Hyperlink or a Menu?
Either way, you have to use the Target option.
For a Menu, the last property shown on the View is called "Target". Enter a value for it, it will cause the Nav URL to be opened on a new window.
Here is how you do it on an HTML anchor tag:
<a href="http://www.cnn.com" target="_new">Click here to go to CNN</a> |
|
|
|
Re: Launch a separate web browser from a menu item.
Posted: 13 Apr 12 7:33 AM
|
fiogf49gjkf0d Thanks but I was able to do it using Nav Url by calling javascript:window.open('http://...../default.aspx', 'xxxxxx', 'status=no,width=625,height=550');
My problem before was the I left off the trailing semicolon.
|
|
|
| |
|
Re: Launch a separate web browser from a menu item.
Posted: 16 Apr 12 10:44 AM
|
fiogf49gjkf0d
ok I have another issue that is causing me a headache.
I need to pass the current user's Authentication Token to my new web site.
Does anyone have input as to how to get it and added it to the url string such as ...default.aspx?token=......?
|
|
|
| |
|
Re: Launch a separate web browser from a menu item.
Posted: 17 Apr 12 8:58 AM
|
fiogf49gjkf0d
Hi Ryan,
Thanks for the input. This looks like the way to go.
Can you tell me what version of SLX web your LeadsMenuModule was written for? As it was written in 2009 I assume it was for an older version. We are using SLX Web 7.5.4 and apparently things have changed.
For example,
1) I cannot find Sage.Platform.Secutity to reference.
2) Objects such as _userService and _parentWorkItem do not exist in the current context.
Do you have an updated version?
Jeff
|
|
|
|
Re: Launch a separate web browser from a menu item.
Posted: 17 Apr 12 4:15 PM
|
fiogf49gjkf0d 1) You don't need that reference for what you're doing. That was for referencing the current user in that sample (which you don't need)
2) You need to create those properties in your module. In the article, it mentions you need to create the dependency injection properties as:
using Sage.Platform.Application; //... private UIWorkItem _parentWorkItem; [ServiceDependency(Type=typeof(WorkItem))] public UIWorkItem ParentWorkItem { get { return _parentWorkItem; } set { _parentWorkItem = value; } }
The UIWorkItem object will be injected into the ParentWorkItem property at runtime and you'll be able to use it to get to the Toolbar workspace and then get the MenuService from there. |
|
|
|
Re: Launch a separate web browser from a menu item.
Posted: 19 Apr 12 11:11 AM
|
fiogf49gjkf0d Thanks Ryan,
After some hair pulling, I was finally to take you example and work out a solution that worked. Not a whole lot different than what you presented, but different all the same.
Now, I have but one more headache to deal with. When the menu item is slected and my new web site appears in a new browser window, SLX is showing a white screen with only the word 'null' on it. Click the back button once and we are back at SLX as expected.
What is causing the white screen with 'null' on it?
How do I prevent or automatically recover from it?
Jeff
P.S. this problem was happeing before I added the code to pass the Token.
|
|
|
|
Re: Launch a separate web browser from a menu item.
Posted: 19 Apr 12 11:17 AM
|
fiogf49gjkf0d Jeff:
I have ran into this before. Try returning false:
"javascript:window.open(your parameters); return false;"
Or, if that doesn't work:
"javascript:window.open(your parameters);1=2;"
|
|
|
|
Re: Launch a separate web browser from a menu item.
Posted: 19 Apr 12 12:15 PM
|
fiogf49gjkf0d Thanks Raul,
I thought I had the return in there.
Alas one syntaic headache after another.
When I add the return such as "javascript:window.open(your parameters); return false;" I get 'Return outside function error. But when I use the 1=2 it works. Neat trick. Can you explain what's going on with that?
Jeff
|
|
|
|
Re: Launch a separate web browser from a menu item.
Posted: 19 Apr 12 1:45 PM
|
fiogf49gjkf0d Originally posted by Jeff L Can you explain what's going on with that?
|
|
The reason for this is that window.open returns an object. The browser is trying to display the result of the function call (Because it is on the HREF area of the Anchor tag, if this was an onclick event this wouldn't happen either).
For example, the alert function returns undefined, so doing javascript:alert('test'); will not affect your page.
So, there are several ways to work around it, one is the method I showed you (adding 1=2 as a second call to stop execution.
Another is to create your own js function and call it there:
"javascript:func=function(){window.open('http://www.cnn.com');}; func();"
Since the function we defined has no return statement, it will return "undefined", and the browser won't do anything else.
|
|
|
|
Re: Launch a separate web browser from a menu item.
Posted: 19 Apr 12 4:04 PM
|
fiogf49gjkf0d In addition to Raul's suggestion, instead of using Javascript, just set the URL of the menu item normally, but then set the Target to "_blank" and it will cause it to open in a new window. IIRC the Target property is exposed on the nav items. |
|
|
|
Re: Launch a separate web browser from a menu item.
Posted: 19 Apr 12 4:15 PM
|
fiogf49gjkf0d Originally posted by Ryan Farley In addition to Raul's suggestion, instead of using Javascript, just set the URL of the menu item normally, but then set the Target to "_blank" and it will cause it to open in a new window. IIRC the Target property is exposed on the nav items.
|
|
Ryan, that was indeed my first suggestion to the original post....
|
|
|
|
Re: Launch a separate web browser from a menu item.
Posted: 19 Apr 12 4:20 PM
|
fiogf49gjkf0d Ah right. Just went back up and reread through the posts.
Jeff, switch from using javascript for the link to just a normal link (you can even set the target in AA, then all you need to do is just set the URl normally). Then all should work. |
|
|
|