How to launch Citrix Xenapp in HTML5 receiver instead of Windows receiver? - citrix

I'm using Citrix StoreFront Web API and implemented all steps to authenticate request and get list of resources. I also was able to launch app with this code:
function performLaunch(resource) {
var icaFileUrl = resource.launchurl,
csrfToken = getCookie('CsrfToken'),
currentTime = (new Date()).getTime(),
frameId = "launchframe_" + currentTime;
// To initiate a launch, an ICA file is loaded into a hidden iframe.
// The ICA file is returned with content type "application/x-ica", allowing it to be intercepted by the Citrix HDX
// browser plug-in in Firefox/Chrome/Safari. For IE, the user may be prompted to open the ICA file.
$('#hidden-iframes').append('<iframe id="' + frameId + '" name="' + frameId + '"></iframe>');
if (csrfToken != null) {
icaFileUrl = updateQueryString(icaFileUrl, "CsrfToken", csrfToken);
}
// Web Proxy request to load the ICA file into an iframe
// The request is made by adding
icaFileUrl = updateQueryString(icaFileUrl, 'launchId', currentTime);
$("#" + frameId).attr('src', icaFileUrl);
console.log('perform launch - url: ' + icaFileUrl);
}
But unfortunately it launches app in Citrix Receiver for Windows. But my goal is launch app in browser. We have installed Citrix Receiver for HTML5 on our web server but i don't know how to launch app there.

I got answer from Citrix Employee
http://discussions.citrix.com/topic/370729-how-to-launch-citrix-xenapp-in-html5-receiver-instead-of-windows-receiver/

Related

How to POST to NetSuite custom record from external site?

I'm trying to integrate a very small custom web application with NetSuite. I want a custom record to be created in NetSuite whenever a user clicks a button in my web application.
I have written a RESTlet that works with the REST API Testing chrome extension. I have successfully created records through that chrome extension.
However, when I try to POST from my web application, I get this error:
"Response to preflight request doesn't pass access control check: No
'Access-Control-Allow-Origin' header is present on the requested
resource. Origin 'null' is therefore not allowed access. The response
had HTTP status code 401."
How can I POST to NetSuite with a RESTlet from an external site? Should I even be using a RESTlet or is there a better way?
RESTlets are meant more as a system to system technology. They require authentication and if you are doing that from a public app your credentials will be compromised.
Netsuite doesn't allow you to set a CORS header so your cross domain integration needs to be via a publicly available suitelet and JSONP.
Since JSONP makes use of get requests you need to make sure your url params end up less than about 2k characters. That's not a standard limit so ymmv
patterns I often use:
Client code:
var url = "public suitelet url from deployment screen";
var params = {
mode: 'neworder',
//simple name/value data
};
$.ajax({
url: url+"&"+ $.param(params) +"&jsoncallback=?",
cache:false,
dataType:'json',
success: function(jResp){
if(!jResp.success){
if(jResp.message) alert(jResp.message);
return;
}
// act on the results
}
});
A library function in the suitelet source file.
function _sendJSResponse(request, response, respObject){
response.setContentType('JAVASCRIPT');
//response.setHeader('Access-Control-Allow-Origin', '*');
var callbackFcn = request.getParameter("jsoncallback") || request.getParameter('callback');
if(callbackFcn){
response.writeLine( callbackFcn + "(" + JSON.stringify(respObject) + ");");
}else response.writeLine( JSON.stringify(respObject) );
}
and then a Suitelet function
function service(request, response){
... do some work and generate a response
var returnObj = {
success:true,
message: '',
result:result
};
_sendJSResponse(request, response, returnObj);
}
That's your browser and its CORS setting
If using chrome ( you should be ;) ) on Windows, create a chrome shortcut with the following flags
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir
Then, kill/restart ALL INSTANCES of chrome in the Task Manager and try your requests again
Otherwise google "disable CORS on MY_BROWSER"

Google places api error in ionic 2

I am using google places api in ionic app.I places google places api script in index.html. The app allow the user to access wifi within specific place. User get internet access after login with our app. When application launch and user is connecting with our network, user do not have access to the internet. So i get error:
Application Error connection to the server was unsuccessful.
Is there anyway to call the google places api after user has access to the internet to avoid the error?
This has been quickly tested in ionic 1 and it works, no reason it shouldn't in ionic 2. But if you know a proper way to add the script tag in angular, just replace this part. The logic is simply to add your resource on the fly to index.html. Don't forget that connexion can appear while app is already started, and that you don't need to add the tag twice (verifications have to be done). Some edits might be done to adapt to ionic 2, sorry my version was made on the 1.
the function to add the script:
function addScriptTag(){
//STORE HERE VALUE TO VERIFY SCRIPT HAS ALREADY BEEN ADDED
var script = document.createElement('script');
script.src = 'http://maps.google.com...';
script.type = 'text/javascript';
document.head.appendChild(script);
}
in $ionicPlatform.ready (network is not available before that)
//CONNECTED AT APP LOADING
var networkState = navigator.connection.type;
if(networkState !== Connection.NONE){
addScriptTag();
}
//IN CASE CONNEXION ARRIVES LATER
$rootScope.$on('$cordovaNetwork:online', function(event, networkState){
if( /* VERIFY SCRIPT NOT ADDED BEFORE */ ){
addScriptTag();
}
}, false);

Facebook Login - Windows 10 UWP - Desktop

I am building a new Universal Windows 10 UWP App, and trying to do a Facebook login.
On Facebook, I have set the Windows App section of my app to have the identifier of my app:
Windows : s-1-15-xxxxxxxxxxxx
Windows Phone : fef49b712e5a843cbfeb0c9d780423fc (Not the actual one)
In the package manifest file, I have added the protocol of:
msft-fef49b712e5a843cbfeb0c9d780423fc
Which means I set my redirect_uri parameter to:
msft-fef49b712e5a843cbfeb0c9d780423fc://authorize
When running on a phone (with Windows 10 Mobile Preview) the service works fine, it opens up the Facebook app on the phone (using fbconnect://authorize?.....), which in turn authenticates, and then opens my app back up - perfect!!
However, when trying the same on the desktop it doesn't work. In my Launcher.LaunchUriAsync() is set to have a fallback Uri of the standard Facebook web dialog (https://www.facebook.com/dialog/oauth?.....) - This is because there is no Facebook app for Windows 10 that supports login.
Sending the same redirect_uri through to Facebook, it opens up the web browser (Edge) and asks for permissions etc. once the permissions have been given, nothing happens. It seems as though the protocol handling isn't working.
Any thoughts would be useful.
On desktop, try using the WebAuthenticationBroker instead of Launcher.LaunchUriAsync as described in this example: http://dotnetbyexample.blogspot.de/2015/06/custom-oauth-login-to-facebook-for.html
private async Task<string> AuthenticateFacebookAsync()
{
try
{
var fb = new FacebookClient();
var redirectUri =
WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString();
var loginUri = fb.GetLoginUrl(new
{
client_id = AppId,
redirect_uri = redirectUri,
scope = ExtendedPermissions,
display = "popup",
response_type = "token"
});
var callbackUri = new Uri(redirectUri, UriKind.Absolute);
var authenticationResult =
await
WebAuthenticationBroker.AuthenticateAsync(
WebAuthenticationOptions.None,
loginUri, callbackUri);
return ParseAuthenticationResult(fb, authenticationResult);
}
catch (Exception ex)
{
return ex.Message;
}
}
Use WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri for redirect_uri.
And update the same uri in facebook developer console.
https://developers.facebook.com/apps//settings/
Facebook developer console

Launching the mail app from a WIndows Store app

I'm trying to create a windows store app that will launch the default mail app (WinJS 8.1). I haven't touched this for a while, but it was working correctly before 8 - 8.1 upgrade. The code looks like this:
var interval = setInterval(function () {
clearInterval(interval);
var formattedBodyText = bodyText.replace(/\n/g, '%0d');
var mailTask = Email.SendNewMail.sendEmail(emailAddress, subject, formattedBodyText);
}, 500);
And the sendEmail function:
sendEmail: function sendEmail(addess, subject, body) {
var mailto = new Windows.Foundation.Uri("mailto:?to=" + addess + "&subject=" + subject + "&body=" + body);
return Windows.System.Launcher.launchUriAsync(mailto);
}
Oddly, this seems to launch Chrome (I assume because that's my default browser). How can I get it to launch the mail app? Has this changed since the 8.1 upgrade?
EDIT:
It looks like the default program for opening mails was changed to Chrome. So, I suppose my question is now: is it possible to FORCE the mail app to open, rather than whatever is associated with the mailto: url? I noticed there was an ms-mail uri - would that be safer to use?
You can't determine which is default mail app in Windows Store app. Moreover there's no way to open Mail app forcefully in Windows Store app. It doesn't make sense. Some user (Like me!) might not like default mail app. So I would recommend to stick to share charm for sending emails.

Processing incoming APP link Titanium Studio Iphone

I'm using Titanium's facebook module to show a apprequests dialog. I could send application request and when I get into the facebook app and hit the notification, I could get into my app.
But, how do I process the incoming URL? I went through the link Deep link with requests
that shows how to do it with Objective C. Any help on how to implement it with Titanium Studio would be appreciated. Thanks.
You can get the arguments with this snippet :
var cmd = Ti.App.getArguments();
if ( (getTypeOf(cmd) == 'object') && cmd.hasOwnProperty('url') ) {
Ti.App.launchURL = cmd.url;
Ti.API.info( 'Launched with url = ' + Ti.App.launchURL );
}
this is called the URLScheme, if you are looking for online docs!
Source: http://developer.appcelerator.com/question/120393/custom-url-scheme---iphone--android