google chrome app script ask to save as userAppPanel - google-apps

I encounter a problem using UIApplication in google app script, but only on Chrome 18.0.1025.142 m, my application works fine on Firefox 3.6, and also on chrome 16.x.x.
I updated my chrome version to 19.0.1084.56 m. And the problem still occurs.
On Chrome 18.0.1025.142 m and 19.0.1084.56 m, I have the following behaviour:
A blank frame is displayed over my spreadsheet when I try to display the UI Application and I'm asked to perform a "Save As" operation for an object userAppPanel.
On Chrome 16.x.x or Firefox 3.6, I have a UI application with a panel, a textbox and a button.
Here is my application creation code:
// Create my application
var mydoc = SpreadsheetApp.getActiveSpreadsheet();
var myapp = UiApp.createApplication();
myapp.setTitle("Translation selector");
// create panels, text boxes and widgets
var mypanel = myapp.createVerticalPanel();
// Create input boxes and button
var textBoxA = myapp.createTextBox();
textBoxA.setName('Input search filter here').setId('SearchText');
var MyButton = myapp.createButton("Fill the tables");
mypanel.add(textBoxA);
mypanel.add(MyButton);
// create handler to respond to events
var clickHandler = myapp.createServerClickHandler("respondToSubmit");
MyButton.addClickHandler(clickHandler);
clickHandler.addCallbackElement(mypanel);
// assemble everything in app
myapp.add(mypanel);
//mydoc.show(myapp);
//return myapp;
var doc = SpreadsheetApp.getActive();
// show the app
doc.show(myapp);
}

I've a similar issue on Chrome 21.0.1180.89 for OSX. Working with a mail merge script which worked perfectly on a, similar up-to-date, chrome on Win8 just a few hours ago.
I'm pretty sure it's a security issue.
De-authorising the app (under account->security) and then reloading the script and re-authorising it helps. Not sure if it's on a per-browser level or something else..

Kindly Add this Code,
As per your question, It works on chrome.
function saveTextAsFile()
{
var textToWrite = document.getElementById('area').value;
var textFileAsBlob = new Blob([textToWrite], {type:'text/plain'});
var fileNameToSaveAs = "ecc.plist"/*Your file name*/;
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
if (window.webkitURL != null)
{
// Chrome allows the link to be clicked
// without actually adding it to the DOM.
downloadLink.href =
window.webkitURL.createObjectURL(textFileAsBlob);
}
else
{
// Firefox requires the link to be added to the DOM
// before it can be clicked.
downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
downloadLink.onclick = destroyClickedElement;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
}
downloadLink.click();
}

I have some users of a script I've developed, FormEmailer (available in the Script Gallery) that are also having this problem. But we were not able to nail the situation that generates this yet.
Is the spreadsheet you're testing yours? Or is it shared and you're not the owner? Do you have other scripts projects on this same spreadsheet? Are you the owner of all scripts?
(I think it's better if you change you edit your question and I my answer, instead of talking in the "limited" comments).

I have the same problem :
More details about this after a few tests. It seems it is due both to user triggering the script to execute, as well as characteristics of the trigger :
- if the function is called from a custom menu in a spreadsheet, everything works fine for everyone
- if function is called onOpen(), everything works fine for everyone
- if an installable onEdit or onOpen trigger has been set on the function, then everything works fine for the person who set it, and bad for others.
The last behavior is observed whether that person is owner or not.
Basically it seems the only times when it doesn't work well is when someone opens or edits a spreadsheet and the function is triggered by an installable trigger installed by somebody else.
This is a pain.

Related

RE:Create a button which when pressed it replaces an existing object on the screen to another object in Smartface App Studio?

After seeing #catherinelagoon's post I also having difficulty in quite understand how to replace an object using a button so is it possible to create a button which when pressed it replaces an existing object on the screen to another object in Smartface App Studio?
I tried using the answer provided in the post however I couldn't understand it much due to I'm a beginner in using Smartface App Studio and coding itself.
Thankyou and sorry for any inconvienience
After you create an image you should add it to a Page so it can show on that page. So here is a simple code for creating and showing an image on the page.
var image = new SMF.UI.Image({
visible: false
});
Pages.Page1.add(image);
function Page1_TextButton1_OnPressed(e) {
image.visible = true;
}

Is it possible to set a subject to the mail app in Windows 8 metro application, if I am using share contract and sharing files?

First of all, I am sharing the content from my windows 8 metro application to another app (for example Mailto app) so:
Now I am sharing files to mailto app using share contract and sharing files from my application,
I wanted to know if: -
Can I set the subject to the mailto app to which I am sharing files as an attachement to that mailto app, if so please let me know how can I do this?
If not, please let me know what is the work around?
As of now, it's not possible.
Windows 8 recently introduced a new API called protocol activation. With Protocol activation, you can launch other windows 8 apps from your application and pass in data. Microsoft worked on Maps app and you can now pass information to the Map app as shown here (URI Scheme for maps application) http://msdn.microsoft.com/en-us/library/windows/apps/jj635237.aspx
See a code walkthrough at http://blog.jerrynixon.com/2012/10/walkthrough-using-windows-8-custom.html
Now, i am sure very soon, you will see some custom parameters for Mail app that you can pass from your app using protocol activation.
Just my 2 cents
No, it isn't possible to do this at the moment.
I may not be understanding the question correctly but if all you want to do is have the ability to click the "Share" button on the Charms Bar, then select the "Mail" app and have the ability to populate the subject line shown when the "Mail" app's share fly-out is displayed then you can follow this approach:
private DataTransferManager dataTransferManager; //class member
// put the following code block wherever you need it:
// Register as a share source
if (this.dataTransferManager == null)
{
this.dataTransferManager = DataTransferManager.GetForCurrentView();
this.dataTransferManager.DataRequested -= this.OnDataRequested;
try
{
this.dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.OnDataRequested);
}
catch
{
};
}
private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
DataRequest request = e.Request;
DataRequestDeferral deferal = request.GetDeferral();
try
{
// this property will set your subject line
// it will also be shown on the Share fly-out (right below the main
// heading that says 'Share'
request.Data.Properties.Title = GetCustomMailSubjectLine();
if (string.IsNullOrEmpty(request.Data.Properties.Title))
{
request.FailWithDisplayText("An operation failed. Please try again.");
}
else
{
// this will also be shown on the Share fly-out, right below the 'Title'
// property set above
request.Data.Properties.Description = GetMyAppsSharingDesciption();
// use request.Data.SetDataProvider() if your data needs to be asynchronously retrieved
// otherwise directly use request.Data.SetData() (or one of the other
//methods depending on what you need)
request.Data.SetDataProvider(StandardDataFormats.Html, RetrieveSharedData);
}
}
finally
{
deferal.Complete();
}
}
private async void RetrieveSharedData(DataProviderRequest request)
{
DataProviderDeferral deferal = request.GetDeferral();
try
{
// this will set your email's body
request.SetData(await GetCustomMailBodyAsync());
}
finally
{
deferal.Complete();
}
}

AIR - StageWebView issue on iPhone when typing into a text field

I am using Adobe Flash Professional CS5.5 to build an iPhone app with AIR 3.
I am implementing the FacebookMobile flash API which uses a StageWebView to display the login form. Everything works fine when I test my app locally (on my computer) but the app always crashes on iPhone as soon as I click on the "Email" text field to type my email and be able to login. The iPhone's keyboard is shown and then my app simply freeze forever (I don't have time to write any character in the text field).
Am I doing something wrong with my StageWebView? I can't figure out why this is happening.
public var webView:StageWebView;
Here is the code where I initialize the StageWebView :
webView = new StageWebView();
webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight );
FacebookMobile.login(handleLogin, stage, permissions, webView);
Any help would be appreciated.
I'm having the same problem too.
When editing a text field, the keyboard appears, but it freezes straight.
Note: when I used CS5 away back it never happend.
var webView:StageWebView = new StageWebView();
webView.stage = this.stage;
webView.viewPort = new Rectangle(10 , 64, 300, 400 );
webView.loadURL( "http://ghasan.yoo7.com/h54-page" );
button_1.addEventListener(MouseEvent.CLICK, closeWebView);
function closeWebView(e:MouseEvent):void
{
webView.stage = null;
webView.dispose();
}

Jquery img preload not working in FireFox

I recently did a small jQuery snippet that allows me to show a loading img until the real image is loaded.
The snippet seems to work in Safari, Chrome but not FireFox.
FireFox only displays a loading alt and never switches to the loaded image.
Here is the snippet
var loading = $('<img src="/media/ajax-loader.gif" alt="loading" />');
$('.thumbnail').each(function(){
var loadIMG = loading.clone();
$(this).after(loadIMG).load(function(){
$(this).fadeIn('fast');
loadIMG.hide();
}).hide();
});
Any ideas why?
You haven't said what exactly is happing on FF but below can be one of the problem. From jquery documentation
It is possible that the load event
will not be triggered if the image is
loaded from the browser cache. To
account for this possibility, we can
use a special load event that fires
immediately if the image is ready.
event.special.load is currently
available as a plugin.
Here's the link for plugin.
Edit:
Based on comments from load event, try below:
$('.thumbnail').each(function(){
var loadIMG = loading.clone();
$(this).after(loadIMG).load(function(){
$(this).fadeIn('fast');
loadIMG.hide();
}).hide();
if (this.complete) $(this).trigger("load");
});
Of course, the plug-in seems to be doing same thing along with handling some other scenarios as well as.

Is it possible to get document of iframe with iframe_id?

AFAIK,I can achieve this goal by window.frames['frame_name']
but if I only know frame_id,is it possible to get the content too?
You can try it out here:
http://maishudi.com/rte-light-read-only/index.html
btw,is it possible to get location attribute through iframe_id?
I tried long ago but failed.
I think this should do it. It works on (the latest) firefox, safari, camino and opera (mac).
You should still do some testing though (especially in IE)
var iframeObj = document.getElementById("theIframeId");
var documentObj = iframeObj.contentWindow || iframeObj.contentDocument;
var location = documentObj.location.href; // I think this only works if
// the content of the iframe comes
// from the same domain.