I have a simple div with onclick attribute. The attribute contains a mailto achor tag so if the visitor click on the div his/her mail client pops up with a new mail window.
My problem is that I have a sample tag in the mail body with line breaks. In OS X Mail.app, Windows' Outlook, Gmail and even in my Windows Phone 7.5 default mail client it works perfectly but on my iPhone or iPad there are no line-breaks.
For line-breaks I use the following code: \u2029.
I copy the whole code so you can understand my problem:
<?php
$linebreak = '\u2029';
$signup_email = 'hello#company.com';
$signup_subject = 'Signup';
$signup_body = 'Dear Company,'. $linebreak . $linebreak .'I would like to signup as the following'. $linebreak .'My name: '. $linebreak .'My e-mail: '. $linebreak . $linebreak . $linebreak .'Best regards, '. $linebreak;
?>
<div id="signup" class="left" onclick="location.href='mailto:<?=$signup_email;?>?subject=<?=$signup_subject;?>&body=<?=$signup_body;?>';">Signup</div>
The sample text is just a sample text, I don't want to make a signup form like this (it would be so lame (: )
OK, I just figured it out.
In this post the author says you should use %0D%0A squence to break lines. And it works! I tried in Gmail, OS X default Mail.app, MS Outlook and Thunderbird on Windows XP/7, Windows Phone 7.5, iOS 5.1 and iOS 4.2.1.
Related
I am trying to add a yes/no message box to a google sheet that will display on an iPad. I have tried all the things below but none of them display the message. My goal is if the user changes a field the macro will change other fields if the user says it is ok. I can get this to work on a windows machine with no issues but when I try it on an ipad the message never appears. At this point I am just trying to get a message box to appear. This is what I have tried
1.
function onEdit(e) {
Browser.msgBox("test");
}
Result: The macros times out
2.
function onEdit(e) {
var html = HtmlService.createHtmlOutputFromFile('Page')
.setWidth(400)
.setHeight(300);
SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
.showModalDialog(html, 'My custom dialog');
}
Page.html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
Hello, world! <input type="button" value="Close" onclick="google.script.host.close()" />
</body>
</html>
I enabled the trigger for onEdit to get it to work and it works on the windows machine without issues but when run on the iPad I get:
Exception: You do not have permission to call Ui.showModalDialog. Required permissions: https://www.googleapis.com/auth/script.container.ui
So next I tried:
3.
function myFunction(){
Logger.log("myFun")
var html = HtmlService.createTemplateFromFile( 'Page' )
.evaluate()
.setWidth( 800 )
.setHeight( 400 );
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.showModalDialog( html, 'My page title' );
}
function onEdit(){
ScriptApp.newTrigger('myFunction')
.forSpreadsheet(SpreadsheetApp.getActive())
.onEdit()
.create();
}
Using the same page.html, this time in executions it looks like it runs but no box appears on the ipad(it does work on windows). I also tried spreadsheetApp.getUi().alert and prompt, these had the same results.
And Yes I have to use the iPad, I can not use another type of tablet.
Issue:
"Exception: You do not have permission to call Ui.showModalDialog. Required permissions: googleapis.com/auth/script.container.ui"
Fix:
What you can do is installing the trigger instead of using a simple trigger. The image below shows the difference between an installed (above) and a simple (below) trigger using the same code.
Output:
Note:
Don't use reserved function names on installed triggers to avoid it being executed twice like what's shown above. Change onEdit to something like promptUI or something else.
If the above fix isn't enough to show the dialog box, then we need to confirm if the issue might just be on the safari browser (if you are using one) since it worked on your other devices which I assumed are not using safari. You can try using an alternative browser in your device such as Google Chrome and see if the same issue persists. I recommended doing this since i'm seeing a number of issues between showModalDialog and safari
EDIT:
I have seen these related posts pointing out that there are some limitations on mobile apps. See the references below.
Also, some answers suggests that you need to access the spreadsheet via browser (google chrome desktop mode) and then trigger the script there.
References:
Add a script trigger to Google Sheet that will work in Android mobile app
google speadsheet api onOpen does not work on mobile ios
Executing Google Apps Script Functions from Mobile App
How to get scripts to work with phones and tablets
I am using Ionic 4 (beta) and am unsure what the best (/easiest) way is to send keys to an input field using Appium.
Ionic HTML code:
<form>
<ion-item>
<ion-label position="floating">E-mail</ion-label>
<ion-input [formControl]="email" id="sign-in-email-input" type="email" autofocus="true"></ion-input>
</ion-item>
</form>
In my appium test I want to send keys to this input. I notice in Chrome dev tools that below the ion-input a native input is created by Ionic, which is in a shadow dom. So -after some googling- I go after it like this:
email = driver.find_element_by_id('sign-in-email-input')
jsCommand = "return arguments[0].shadowRoot.querySelector('input');"
emailNative = driver.execute_script(jsCommand, email)
emailNative.send_keys('test#test.com')
But the send_keys command throws "StaleElementReferenceException: Message: Element is no longer attached to the DOM".
I'm going around this by doing:
email = driver.find_element_by_id('sign-in-email-input')
jsCommand = "arguments[0].shadowRoot.querySelector('input').value = 'test#test.com';"
driver.execute_script(jsCommand, email)
That seems to work at first (I see the value appear in the IOS simulator). But when focus moves to another field, the value disappears.
What is the correct way to send keys with Appium to an input in Ionic 4?
Is it possible to provide spaces or new line or line breaks on gmail compose on URL schemes. I tried both /n or stringByAddingPercentEscapesUsingEncoding, but space or lines breaks are not reflecting.
googlegmail:///co?subject=subject&body= "\n\n\n textfirstname"
This is not an issue with iOS or url-scheme. You need to use html tag to set new line. For HTML there are <br/> or <br /> which are used to break line. Use this tag instead of \n.
As per you code it should looks like this:
Whatever<br/>text<br/>you<br/>want
I hope this will be useful to you.
when hyperlink is sent in an email, the hyperlink works fine as long as it doesn't end with an "=" character. e.g
<code>
http://example.com/my-service?access-token=abcd1219191=
</code>
When seen in Microsoft Outlook on Windows the = character at the end of hyperlink is no longer a part of the hyperlink i.e
<code>
<http://example.com/my-service?access-token=abcd1219191>=
</code>
only the part between <> remains a hyperlink , this causes link to not work as expected.
Any clues to get around this problem??
Note : The above thing works perfectly fine on Microsoft Outlook for Mac.
Here is a workaround to solve the above problem
just replace any trailing equals sign with the encoded version i.e %3D , the hyperlink would work perfectly alright.
e.g replace http://example.com/service/access=12snssamhsdh= with
http://example.com/service/access=12snssamhsdh%3D
Send Your Hyperlink with Double quotes appended at the Front and Back of the link
For Example:
send it as
"http://example.com/my-service?access-token=abcd1219191="
and not
http://example.com/my-service?access-token=abcd1219191=
I have been searching for an answer all around the web, but couldn't find anything.
I am developing Blackberry Webworks application and the problem is with dialog and unicode. For example:
when I use simple javascript alert(unicodeMsg); unicode works fine, I can use any character including Russian or Lithuanian. The problem is that the alert box has title "JavaScript Alert" and it annoys a bit.
when I use native alert either phonegap or webworks like:
blackberry.ui.dialog.standardAskAsync(unicodeMsg,
blackberry.ui.dialog.D_OK, {
title : unicodeTitle,
size: blackberry.ui.dialog.SIZE_MEDIUM,
position : blackberry.ui.dialog.CENTER
});
it doesn't show any unicode characters. I tried pretty much everything (setting my document in utf-8, using \uxxxx characters, changing meta tags from utf-8 to windows-1257 but nothing works)
I suppose the problem is not with html or js documents neither with the script. Can someone help me?
You need to encode the unicode characters like so text: unescape(encodeURIComponent(unicodeStr)) .
There is an example here - http://blackberry-webworks.github.com/WebWorks-API-Docs/WebWorks-API-Docs-next-BB10/view/blackberry.invoke.html