Alert showing html code as text in Ionic 4 - ionic-framework

This code works fine for Ionic 3 but in Ionic 4 beta 12, still not working. Is this a bug? should I report it? how? I read the beta doc and it doesn’t say anything of configuring how to render the text as html or not.
async showRules() {
const alert = await this.alertController.create({
header: 'Rules',
subHeader: `<!--<div class="padding">-->
Brain Builder is up to date with the most recent research regarding IQ enhancement.
As the most recent research suggest, Brain Builder will increase the number of stimulus first (position, audio, color, etc.).
Once all stimuli have been mastered, the n-back will be increased.
<h3 class="title">
<center>
Rules for beginners
</center>
</h3>
<p>
A blue square will be shown every three seconds, press the button ‘Position’ when you find that the actual position of the blue square matches with that of the previous one.
The position of the square is accompanied with the pronunciation of a number and the very same rule applies for the sound.
</p>
`,
buttons: ['OK'],
backdropDismiss: false
});
await alert.present();
}

I didn't see an open issue for this in the [Ionic Project Issues Section][1]
I recommend creating an issue there and monitoring it until Ionic 4 is out of Beta and in Production.
This is the link to create an Ionic Bug Report
https://github.com/ionic-team/ionic/issues/new?template=bug_report.md
Happy Coding!
-Troy

Related

Ionic / Capacitor flickering screen and refresher not working

I am developing an app, and it works 100% in android. In IOS I have 2 issues:
refresher does not work
<ion-refresher slot="fixed" #ionRefresh="doRefresh($event)">
there is a flicker when I touch the screen (may be related to background? I read some old posts about that)
ion-content.background{
--background: url(/bg.png) 0 0/100% 100% no-repeat;
}
I don't believe its relevant to this issue, but I am using vuejs.
I tested in various desktop browsers and it works as well.
So, we had 2 things here, and I thank #johnborges for following up
it was necessary to add the pullingIcon
link for Ionic docs
and the relevant paragraph
Using the iOS native ion-refresher requires setting the pullingIcon
property on ion-refresher-content to the value of one of the available
spinners. See the Spinner Documentation for accepted values. The
pullingIcon defaults to the lines spinner on iOS. The spinner tick
marks will be progressively shown as the user pulls down on the page.
the flicker, based on this link from stackoverflow I added a CSS DIV element instead of styling ion-content. It worked. I had to do a secodn CSS trick because one of my pages had fullpage slides and padding, but after that it worked

Ionic 3 Image mapping issue

I would like to use 'image mapping' with shape poly or other solution to build an app, based on image handled functionality.
I have tried it using in Ionic 3 and worked fine in Browsers, but under Android it does not.
Is there any solution to solve it?
This picture and functionality would the part and parcel of my app so it is indispensable to create clickable areas on image.
UPDATE:
This is the 9's tooth shape from 32 :) I have an universal denture image with the normal 32 tooth shape. My goal is to transform the image to a 32 clickable tooth, with their own shape.
It is important to know, on which tooth the user clicked, because I want to give for the clicked tooth a colored background. This works on browser under Ionic3 fine, but builded to android not.
'<'img src="denture.png" usemap="#image-map"'>'
'<'map name="image-map"'>'
'<'area target="_blank" alt="Tooth9" title="Tooth9" href="Tooth" coords="407,93,421,89,434,87,447,90,458,91,468,94,478,103,480,112,476,125,471,135,467,146,462,153,453,158,441,158,428,152,419,141,412,129,406,118,401,109,403,98" shape="poly"'>'
'<'area target="" alt="" title="" href="" coords="" shape="0"'>'
'<'/map'>'

IBM Worklight - How to disable Native device features?

I have created my application using IBM Worklight in Eclipse. I have added the iPhone environment and installed successfully my application on my device, but I have noticed that in some screens numbers appear with an underline and when tapped it shows a dialog box with call function.
I have tried using text-decoration:none so that underline does not appear, but it is still appearing. I have tried:
HTML
<span class="bluelink" data-dojo-type="dojox.mobile.TabBarButton">40562231</span>
CSS
.bluelink {
color:#1238a6; text-decoration:none;
}
Another issue I am facing is that when using alert(), it shows the title title as the HTML filename like MyApp.html. Anybody know how to fix this?
Instead of alert() use the WL.SimpleDialog API. Explained here.
WL.SimpleDialog.show(
"My Title",
"My Text",
[{
text: "First Button",
handler: function() {
WL.Logger.debug("First button tapped");
}
}]
)
As for the phone number, try the option here:
http://razoredgelabs.com/2013/03/how-to-stop-apple-ios-devices-from-styling-phone-numbers/
There are also the following questions:
How do I remove the blue styling of telephone numbers on iPhone/iOS?
Mobile HTML rendering numbers
Prevent Phone Number recognition on JqueryMobile
How to disable phone number linking in Mobile Safari?
https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/Articles/PhoneLinks.html

webkit img 100% width issues

Sample Link
I am using jQuery cycle to slide through these images I am having issues in iOS webkit getting the #imagegallery img to scale 100% width.
Any Ideas?
I found this but still can't get it working properly.
If you just google for this error, you will find plenty of people having troubles with the jQuery plugin applied to images. Troubles happens usually in terms of position and showing.
My feeling is that sometime the script is run just before the images are loaded and the used width/length values for cycling the images are wrong. I would suggest you to add something like this to your page (adapt classes and names to your needs):
<script type="text/javascript">
$(document).ready(
function() {
$('.image-list li').each(function({$(this).css({
[SET HERE POSITION, WIDTH, ETC]});});
$('.image-list').cycle([OPTIONS]);
}
);
</script>

How to disable phone number linking in Mobile Safari?

Safari on iPhone automatically creates links for strings of digits that appear to the telephone numbers. I am writing a web page containing an IP address, and Safari is turning that into a phone number link. Is it possible to disable this behavior for a whole page or an element on a page?
This seems to be the right thing to do, according to the Safari HTML Reference:
<meta name="format-detection" content="telephone=no">
If you disable this but still want telephone links, you can still use the "tel" URI scheme.
Here is the relevant page at Apple's Developer Library.
I use a zero-width joiner ‍
Just put that somewhere in the phone number and it works for me. Tested in BrowserStack (and Litmus for emails).
To disable the phone parsing appearance for specific elements, this CSS seems to do the trick:
.element { pointer-events: none; }
.element > a { text-decoration:none; color:inherit; }
The first rule disables the click, the second takes care of the styling.
Add this, I think it is what you're looking for:
<meta name = "format-detection" content = "telephone=no">
I was having the same problem. I found a property on the UIWebView that allows you to turn off the data detectors.
self.webView.dataDetectorTypes = UIDataDetectorTypeNone;
Solution for Webview!
For PhoneGap-iPhone / PhoneGap-iOS applications, you can disable telephone number detection by adding the following to your project’s application delegate:
// ...
- (void)webViewDidStartLoad:(UIWebView *)theWebView
{
// disable telephone detection, basically <meta name="format-detection" content="telephone=no" />
theWebView.dataDetectorTypes = UIDataDetectorTypeAll ^ UIDataDetectorTypePhoneNumber;
return [ super webViewDidStartLoad:theWebView ];
}
// ...
source: Disable Telephone Detection in PhoneGap-iOS.
To disable phone number detection on part of a page, wrap the affected text in an anchor tag with href="#". If you do this, mobile Safari and UIWebView should leave it alone.
1234567
You can also use the <a> label with javascript: void(0) as href value. Example as follow:+44 456 77 89 87
Think I've found a solution: put the number inside a <label> element. Haven't tried any other tags, but <div> left it active on the home screen, even with the telephone=no attribute.
It seems obvious from earlier comments that the meta tag did work, but for some reason has broken under the later versions of iOS, at least under some conditions. I am running 4.0.1.
My experience is the same as some others mentioned. The meta tag...
<meta name = "format-detection" content = "telephone=no">
...works when the website is running in Mobile Safari (i.e., with chrome) but stops working when run as a webapp (i.e., is saved to home screen and runs without chrome).
My less-than-ideal solution is to insert the values into input fields...
<input type="text" readonly="readonly" style="border:none;" value="3105551212">
It's less than ideal because, despite the border being set to none, iOS renders a multi-pixel gray bar above the field. But, it's better than seeing the number as a link.
I had an ABN (Australian Business Number) that iPad Safari insisted on turning into a phone number link. None of the suggestions helped. My solution was to put img tags between the numbers.
ABN 98<img class="PreventSafariFromTurningIntoLink" /> 009<img /> 675<img /> 709
The class exists only to document what the img tags are for.
Works on iPad 1 (4.3.1) and iPad 2 (4.3.3).
I have tested this myself and found that it works although it is certainly not an elegant solution. Inserting an empty span in the phone number will prevent the data detectors from turning it into a link.
(604) 555<span></span> -4321
I had the same problem, but on an iPad web app.
Unfortunately, neither...
<meta name = "format-detection" content = "telephone=no">
nor ...
0 = 0
9 = 9
... worked.
But, here's three ugly hacks:
replacing the number "0" with the letter "O"
replacing the number "1" with the letter "l"
insert a meaningless span: e.g., 555.5<span>5</span>5.5555
Depending on the font you use, the first two are barely noticeable. The latter obviously involves superfluous code, but is invisible to the user.
Kludgy hacks for sure, and probably not viable if you're generating your code dynamically from data, or if you can't pollute your data this way.
But, sufficient in a pinch.
A trick I use that works on more than just Mobile Safari is to use HTML escape codes and a little mark-up in the phone number. This makes it more difficult for the browser to "identify" a phone number, i.e.
Phone: 1-800<span>-</span>620<span>-</span>3803
Why would you want to remove the linking, it makes it very user friendly to have th eoption.
If you simply want to remove the auto editing, but keep the link working just add this into your CSS...
a[href^=tel] {
color: inherit;
text-decoration:inherit;
}
<meta name = "format-detection" content = "telephone=no"> does not work for emails: if the HTML you are preparing is for an email, the metatag will be ignored.
If what you are targeting are emails, here's yet another ugly-but-works solution for ya'll:
Example of some HTML you want to avoid being linked or auto formatted:
will cease operations <span class='ios-avoid-format'>on June 1,
2012</span><span></span>.
And the CSS that will make the magic happen:
#media only screen and (device-width: 768px) and (orientation:portrait){
span.ios-date{display:none;}
span.ios-date + span:after{content:"on June 1, 2012";}
}
The drawback: you may need a media query for each of the ipad/iphone portrait/landscape combos
You could try encoding them as HTML entities:
0 = 0
9 = 9
Same problem in Sencha Touch app solved with meta tag (<meta name="format-detection" content="telephone=no">) in index.html of app.
This answer trumps everything as of 6-13-2012:
<a href="#" style="color: #666666;
text-decoration: none;
pointer-events: none;">
Boca Raton, FL 33487
</a>
Change the color to whatever matches your text, text decoration removes the underline, pointer events stops it from being viewed like a link in a browser (pointer doesn't change to a hand)
This is perfect for HTML emails on ios and browser.
I too have this problem: Safari and other mobile browsers transform the VAT IDs into phone numbers. So I want a clean method to avoid it on a single element, not the whole page (or site).
I'm sharing a possible solution I found, it is suboptimal but still it is pretty viable: I put, inside the number I don't want to become a tel: link, the ⁠ HTML entity which is the Word-Joiner invisible character. I tried to stay more semantic (well, at least a sort of) by putting this char in some meaning spot, e.g. for the VAT ID I chose to put it between the different groups of digit according to its format so for an Italian VAT I wrote: 0613605⁠048⁠8 which renders in 0613605⁠048⁠8 and it is not transformed in a telephone number.
Another option is to replace the hyphens in your phone number by the character ‑ (U+2011 'Unicode Non-Breaking Hyphen')
I was really confused by this for a while but finally figured it out. We made updates to our site and had some numbers converting to a link and some weren't. Turns out that numbers won't be converted to a link if they're in a <fieldset>. Obviously not the right solution for most circumstances, but in some it will be the right one.
Break the number down into separate blocks of text
301 <div style="display:inline-block">441</div> 3909
Adding the meta tag to turn off format detection did not work for me. I was trying to display a zoom meeting ID in a <p> tag along with other text and iOS was turning that ID into a tel link. Additionally, I was targeting tel links via a[href^="tel:"] in order to give them custom styling so disabling the styles on tel links was not an option.
The solution I found was to wrap the ID number in a <code> tag. This seems to prevent iOS from messing with it.