Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser.

Posts under HTML tag

200 Posts

Post

Replies

Boosts

Views

Activity

run Javascrip on Safari
Hello, I am experiencing an issue when running a script on Safari, specifically WebKit. Here is a sample HTML code: <!DOCTYPE html> <html lang="en"> <head> <script> function delayedFocus(e) { e.preventDefault(); setTimeout(function() { e.target.focus(); }, 1000); // Adjust the delay time as needed (in milliseconds) } </script> </head> <body> <ul> <li> <input type="text" id="testtext" onmousedown="delayedFocus(event)"> </li> </ul> </body> </html> The logic behind this script is to introduce a 1-second delay when the user clicks on the textbox. After 1 second, the keyboard should appear. Testing on Android mobile devices shows the expected behavior. However, on iPhones, the textbox receives focus, but the keyboard does not appear. This issue has been observed on various iOS versions, with the script working only on iOS 15. If you have any insights or solutions to address this compatibility issue, it would be greatly appreciated. Thank you.
0
0
815
Feb ’24
Link cant be opened inside iframe
Hi, I have a mobile app that uses iframe to show the html content. I noticed that the link cant be opened on the IOS but its works well on android. Here's general example html code: <iframe id="view-html-viewer-iframe" src="about:blank" frameborder="0"> ... <p><a href="https://google.com/" target="_parent">Google</a></p> ... </iframe> Anyone encounter the same issue.? is there any solution for this.? Thanks.
Topic: Safari & Web SubTopic: General Tags:
0
1
751
Jan ’24
Table filter in a flask app works fine on Chrome, FireFox, and IE but does not work on Safari
I have a table with a filter. The table only displays the table rows that matches the filter. In the javascript code, I have a filterInteraction() function that have a commonElements list and display the table rows if they are included in the commonElements list. In my html, when the user click, the filterInteraction() will be triggered. Here's part of my filterInteraction() function (the sensitive code is removed): " function filterInteraction(){ let searchList = searchResult(); let checkboxList = checkboxResult(); let commonElements = searchList.filter(element =&gt; checkboxList.includes(element)); console.log("commonElements ==========", commonElements) var table, tr, i; table = document.getElementById("employeeTable"); let rows = table.getElementsByTagName("tbody")[0].getElementsByTagName("tr"); for (i = 0; i &lt; rows.length; i++) { let currentName = rows[i].getElementsByTagName("td")[0].textContent.trim(); if(commonElements.includes(currentName)){ rows[i].style.visibility = "visible"; // rows[i].removeAttribute("hidden"); // rows[i].style.display = ""; } else{ rows[i].style.visibility = "hidden"; // rows[i].setAttribute("hidden", true); // rows[i].style.display = "none"; } } countPart(commonElements.length); }". In this function, I printed the commonElements list, and the list is always correct. However, for the display, it's switching between displaying nothing and displaying the correct rows. (When entering the Safari, the first click on the filter makes the table empty, but the second click displays the correct rows, the next click will make the table displays nothing again .... ). Even during the time that the table display nothing, the commonElements list printed in console is still correct, which means the function does have the correct table rows, but they are not displayed. I tried three different ways to display the table row: "rows[i].style.visibility = "visible"; rows[i].removeAttribute("hidden"); rows[i].style.display = "";". None of them could work without the bug I mentioned above. I tested my filter on Chrome, FireFox, and IE, and my filter works perfectly on them. Any possible way to solve the issue on Safari? Why it has the display bug like this in Safari? Really need help!!! Thanks
1
0
808
Jan ’24
HTML NSAttributedString technique that avoids Sonoma's TextKit issues
Basic HTML strings do not display correctly on macOS Sonoma, I am wondering if there is an alternative technique that can be utilized. There was a minor change in macOS 14.2, which fixed some cases but made others much worse. Consider the following code: override func viewDidLoad() { super.viewDidLoad() let html = """ <table width="100%" border="1" style="color: white"> <tr> <td align="left">Left</td> <td align="right">Right</td> </tr> </table> """ let data = Data(html.utf8) let definition = try! NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: NSNumber(value: String.Encoding.utf8.rawValue)], documentAttributes: nil) let frameRect = NSRect(x: 100, y: 0, width: 300, height: 200) let textView = NSTextView(frame: frameRect) textView.textStorage?.setAttributedString(definition) textView.backgroundColor = .clear view.addSubview(textView) } On macOS 14 (23A5312d) it looks like this (FB13170237): On macOS 14.2 (23C64) it looks like this (FB13465833):
1
0
1.1k
Jan ’24
After clicking button while submitting form in "jsp" page, loader is not working properly
Hi, We are facing an issue in our page , The same works fine in other operating systems like android and windows. we are facing this issue only on IOS and MAC(safari browser alone ). We have a loader with us ,which will be shown in 2 different phases in our page. The first time loader will be shown while page is being loaded, the second loader will be shown once the user clicks on pay button. the first loader is not giving any issues for us .But the second loader is not loading completely as you can see in the attached not working image ,the blue circle is being displayed only a 5-10%. It should start from 0 and gradually should reach 100% and again a loop. From the analysis we could see the loader rotates fine after clicking pay button ,but once after page is submitted the issue happens document.paypage.submit(); (code attached below) // this is the form submission in our page // once the control reaches this line we could see the loader is not working fine. the same scenario is checked in android ,but even after page submission the loader works fine, Only in IOS and mac we are facing issue in (safari in mac other browser works fine without any issue), (all browsers in iOS). please direct us to solve the issue Attached images of working and not working scenario Not Working Working Code sample <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Loader</title> <style> .loader { position: relative; margin: 0 auto; width: 100px; &:before { content: ""; display: block; padding-top: 100%; } } .circular { animation: rotate 3s linear infinite; height: 100%; transform-origin: center center; width: 100%; position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; } .background-ring { fill: none; stroke: rgb(227, 226, 231); stroke-width: 5; } .path { stroke-dasharray: 1, 200; stroke-dashoffset: 0; animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite; stroke-linecap: round; } @keyframes rotate { 100% { transform: rotate(360deg); } } @keyframes dash { 0% { stroke-dasharray: 1, 200; stroke-dashoffset: 0; } 30% { stroke-dasharray: 95, 200; stroke-dashoffset: -30px; } 100% { stroke-dasharray: 89, 200; stroke-dashoffset: -124px; } } @keyframes color { 100%, 0% { stroke: rgb(14, 236, 218); } 40% { stroke: rgb(14, 236, 218); } 66% { stroke: rgb(14, 236, 218); } 80%, 90% { stroke: rgb(14, 236, 218); } } body { background-color: var(--white); } .showbox { display: flex; position: absolute; top: 0; bottom: 0; left: 0; right: 0; padding: 5%; } </style> </head> <body> <div class="showbox"> <div class="loader"> <svg class="circular" viewBox="25 25 50 50"> <!-- Background ring --> <circle class="background-ring" cx="50" cy="50" r="22" /> <!-- Loading circle --> <circle class="path" cx="50" cy="50" r="22" fill="none" stroke-width="4" stroke-miterlimit="10" /> </svg> </div> </div> </body> </html>
0
0
902
Jan ’24
"Google pay button icon" not visible in specific iOS versions
Hi, The below code is used for loading GPay icon dynamically from Google in "WKWebView". The same code works for later versions of IOS like 16.4, but issue happens in 16.1 ,16.2 and 16.3 versions. while loading this code from IOS 16.3 the icon (Gpay icon) is completely black, looks like it's not loaded properly. Please assist us on what can be the issue, and how we can proceed to solve the issue. Not working Working
0
0
936
Jan ’24
HTML tags in UILabel don't work
Hi, I've got this html text: "<style>* {font-size: 12pt !important;color: #000000 !important;font-family: Montserrat-Regular !important;}</style>Perform the following steps:<br><u>Option 1:</u><br><p>1) Upon receiving a push notification alert, tap on the push notification to launch BIMB Authenticator</p><p>2) Verify the transaction details and choose \"Approve\"</p><p>3) Complete</p><br><u>Option 2:</u><br><ol><p>1) If you didn’t receive push notification, you may launch BIMB Authenticator</p><p>2) Verify the transaction details and choose \"Approve\"</p><p>3) Complete</p>" And I'm trying to show this HTML text properly in a UILabel. This is my codes: String extension to map to NSAttributedString: extension String { func attributedStringFromHTML() -> NSAttributedString? { guard let data = "\(self)" .data(using: .utf8, allowLossyConversion: false) else { Log.error(category: .transaction, message: "Unable to decode data from html string: %@", self) return nil } let options: [NSAttributedString.DocumentReadingOptionKey: Any] = [ .documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue ] if let attributedString = try? NSAttributedString(data: data, options: options, documentAttributes: nil) { return attributedString } else { Log.error(category: .transaction, message: "Unable to create attributed string from html string: %@", self) return nil } } } And this is the result: Can you tell me how to fix this? Thanks.
0
0
961
Dec ’23
iOS 17 Safari dropped support for #canonicalWebPageURL links?
iOS 17 Safari will not successfully open .reality (Reality Composer) files from a weblink. For example, this code works fine on iOS 16: The same code generates this message on iOS 17 after clicking on the link: "Object requires a newer version of iOS." QuickLook fails to render anything. I validated that the .reality file works fine when opened from iOS 17 Files app, so it's not a damaged file.
0
1
712
Dec ’23
iOS and iPadOS date pickers ignores min/max date range when opening
In web-based apps we want date pickers to open to a previous month based on the min-max date range specified on the input. We do not want to set a specific day but want the user to select a date. Android devices and Windows OS (Chrome and Edge) all behave as expected, namely, when the calendar loads the first month specified as the min value displays. iOS devices always open the calendar showing the current month and ignore the min/max attributes on the input. Additionally, the current date is selected making it very easy for the use to accidentally choose the wrong date by accidentally closing the date picker. It appears that iOS is the only platform not supporting min/max on date inputs. Will this be fixed? Or is it this by design? For example, today is December 13, 2023, we expect that selecting the following input to open the native calendar displaying November 2023 and to not select a date. <input autocomplete="off" type="date" placeholder="M/d/yy" min="2023-11-01" max="2023-11-30">
0
2
1.5k
Dec ’23
Weird dark overlay issue in HTML canvas on iOS. 17 and later
Since the update to iOS 17, the pictures in our virtual tours randomly turn very dark and high contrast. They are shown in a canvas so it looks like the entire canvas content is being manipulated. However nothing in our code does this, it happens very randomly (not in every picture and also not in the same pictures every time) and it's only in iOS 17 (not in other iOS versions, not on iPadOs, Mac, Windows, Android, ...). We tried debugging for hours and hours but nothing indicates that this is caused by anything in our code. To try it out yourself: visit https://youreka-virtualtours.be/tours/vyncke_buhler (on mobile of course). Screenshot shows what I mean. Sometime you have to click around randomly. Left screenshot in the side by side is after refresh. You can also see the effect disappears when looking at the browser tabs overview.
9
1
1.7k
Dec ’23
macOS 14 - NSAttributedString created from HTML displays as "undefined character" glyphs when certain fonts are used
I allow users to choose a font to use throughout the app, then display text using that font in 3 different ways: As the default body font of an HTML document displayed in a WKWebView. Used to create an NSAttributedString then displayed in an NSTextField. Used as the body font of a very small HTML document (2-3 lines), converted to NSAttributedString, then displayed in an NSTextField. My code has been working fine for years, but starting with the release of Sonoma (macOS 14), any text that is converted from HTML to NSAttributedString displays as all "question marks in boxes" for each character. This happens when certain fonts are used. In particular I've seen it with Calibri, Candara, and SF Pro. Calibri and Candara are Microsoft fonts and I think are distributed with MS Office. SF Pro is an Apple font. There could be others; I haven't done an exhaustive check. What I can tell you is that this has been working fine literally until a couple weeks ago when customers began installing macOS 14. If they go into my app and select a different font (such as Arial or Times New Roman) everything works fine. It is only certain fonts that don't work, and those fonts work when used as the body font of an HTML document in WKWebView and when used as the font for a new NSAttributedString. They just don't work if you make a little HTML document with the font selected as the body font, then convert to NSAttributedString. Here's the code that worked up until macOS 14: NSString *htmlString = @"&amp;lt;!DOCTYPE html&amp;gt;" "&amp;lt;html&amp;gt;" "&amp;lt;head&amp;gt;" "&amp;lt;style&amp;gt;" "body { font-family: 'Candara', serif; font-size: 14px; }" "&amp;lt;/style&amp;gt;" "&amp;lt;/head&amp;gt;" "&amp;lt;body&amp;gt;" "This won't display right." "&amp;lt;/body&amp;gt;" "&amp;lt;/html&amp;gt;"; NSData *htmlData = [htmlString dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)}; NSError *error; NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:htmlData options:options documentAttributes:nil error:&amp;amp;error]; Note the fallback of "serif" — that doesn't matter. you get all undefined characters and the fallback font is not used. It's as if the renderer really believes the font is usable, but it isn't.
1
0
1.1k
Nov ’23
No markup for Markdown in XCode!
The Text inside README.md or any other Markdown files added to the project's bundle, simply are not formatted when previewed in XCode. Almost all of the opensource projects have instructions in Markdown at the top level of the project & even Apple use MD in their sample projects. Magically, the .md files in Apple sample projects are formatted as expected as you can see below, but this isn't the case in any other project. I've also checked the file's settings in the XCode inspector and it didn't differ from the ones existing in the Apple code samples. This is how we are used to view Markdowns in XCode. And this is is the README.md in HappyBeam which is formatted.
2
0
2.2k
Nov ’23
NSAttributedString doesn't format HTML tables properly on Sonoma
This issue has already been reported to Apple via the Feedback Assistant as FB12401598 and a code-level support incident has been opened to follow up, but so far I haven't heard anything. The problem is that the NSAttributedString used to be able to load HTML files correctly via the [NSAttributedString initWithHTML:options:documentAttributes:] method (or its Swift equivalent). As of the developer beta of Sonoma, however, this no longer works. The method loads the attributedString but HTML tables are completely ignored. Every cell in the table just appears on a new line. The app I'm working on has a bunch of HTML templates that get drawn inside another View using an NSAttributedString. This has worked for years but no longer works on Sonoma. Does anyone know a decent workaround for correctly drawing some formatted text whose formatting is specified via HTML? I'm currently exploring the idea of converting the HTML files to RTF on an older system and using RTF, but the RTF format isn't nearly as simple as HTML. Here's a screenshot of a simple project and Safari showing the same HTML side by side
Topic: Safari & Web SubTopic: General Tags:
6
0
1.9k
Nov ’23
Data is getting truncated at the page end and displaying other half in next page in a Pdf render. This issue is reproducing only on ios 17 version ipads wheere data is loading with wkwebView.
I need help for this issue which is happening only in ios 17 ipad devices. I have an application which generates report in a pdf form. We are loading the html file as a string to webkit webView which is further helping us by generating the content in pdf format. our report contains rows & columns which uses div tags and few css properties. If we view the report which is in pdf form, the data is getting truncated for a row horizentally at the page end and displaying the remaing truncated data in the next page. This issue is happening only in ios 17 updated devices. It was working fine and displaying the data correctly with same html content. Please let me know any possible ways through which I can resolve this issue. I have tried few properties like page-break-X(inside,before,after)- avoid; margin-bottom, padding etc...nothing worked for me.
0
0
745
Nov ’23
Document-based Apple App that can run on iOS, iPadOS, and macOS
I am new to developing native Apple apps and must familiarize myself with the Apple development frameworks. I am starting to create a personal document-based Apple App that can run on iOS, iPadOS, and macOS. The document will contain the following: HTML, PDF, images, video, and audio files. So, I think the document format could be HTML. I need the capability to read, edit (WYSIWYG Editor), save, and share documents with other users using the same app. The data is stored in the user's device and iCloud. I need guidance about what Apple framework I should use to edit the documents using WYSIWYG editing principles. I would really appreciate any recommendation you can provide. Many thanks for considering my request. Thank you so much for your attention and participation.
2
0
1.4k
Nov ’23
Can't scroll past a video with playsinline attribute inside an iframe [Safari iOS 17.0.3]
I'm loading a page inside an iframe. The page contains a video with the playsinline attribute. The video is completely unresponsive to touch events, meaning if it fills up the screen I can't scroll past it, thus breaking the page. Note the video also has autoplay, loop and muted attributes but these did not cause scrolling issues; only playsinline causes the break. Myself and another tester are running Safari on an iPhone 14 with iOS 17.0.3 and it's broken for both of us. Confirmed with 2 additional testers there is no issue with iPhones running iOS 16.6. Test case: https://codepen.io/gem0303/pen/qBgEeaG Repro steps: Load in Safari on an iPhone with iOS 17.0.3 Tap and drag on the white background and dummy scrolling text -- works fine. Tap and drag on the cat video -- scrolling is impossible.
4
1
2.1k
Oct ’23
Scroll Issues in ios browsers
I am facing an issue in scrollable components as I have a parent component and child component both are scrollable but when I get to the end of my child component then it should scroll the parent component by default but it gets stuck in the child components scroll only. FYI, I am using reactJs if it helps in any case.
0
0
817
Oct ’23
Instantiating "HTML-styled" NSAttributedString in a View's body produces weird behaviour
In an attempt to expose the capabilities of NSAttributedString in combination with UITextView to the world of SwiftUI (specifically the ability to render basic HTML), I've wrapped UITextView in a UIViewRepresentable and used that in a custom SwiftUI View. But I'm seeing some issues I can't really explain... So I would love to get a deeper understanding of what's going on. And possible also find a way to fix these issues in an appropriate way. This is how it goes: UIViewRepresentable wrapping UITextView to display NSAttributedString in the context of SwiftUI import SwiftUI struct AttributedText: UIViewRepresentable { private let attributedString: NSAttributedString init(_ attributedString: NSAttributedString) { self.attributedString = attributedString } func makeUIView(context: Context) -> UITextView { let uiTextView = UITextView() // Make it transparent so that background Views can shine through. uiTextView.backgroundColor = .clear // For text visualisation only, no editing. uiTextView.isEditable = false // Make UITextView flex to available width, but require height to fit its content. // Also disable scrolling so the UITextView will set its `intrinsicContentSize` to match its text content. uiTextView.isScrollEnabled = false uiTextView.setContentHuggingPriority(.defaultLow, for: .vertical) uiTextView.setContentHuggingPriority(.defaultLow, for: .horizontal) uiTextView.setContentCompressionResistancePriority(.required, for: .vertical) uiTextView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) return uiTextView } func updateUIView(_ uiTextView: UITextView, context: Context) { uiTextView.attributedText = attributedString } } Used in a custom HTML SwiftUI View import SwiftUI struct HTML: View { private let bodyText: String init(_ bodyText: String) { self.bodyText = bodyText } var body: some View { AttributedText((try? NSAttributedString( data: """ <!doctype html> <html> <head> <meta charset="utf-8"> <style type="text/css"> body { font: -apple-system-body; color: white; } </style> </head> <body> \(bodyText) </body> </html> """.data(using: .utf8)!, options: [ .documentType: NSAttributedString.DocumentType.html, .characterEncoding: NSUTF8StringEncoding, ], documentAttributes: nil )) ?? NSAttributedString(string: bodyText)) } } Put together in a simple SwiftUI app import SwiftUI struct ContentView: View { var body: some View { NavigationStack { ScrollView { HTML(""" <p>This is a paragraph</p> <ul> <li>List item one</li> <li>List item two</li> </ul> """) } .navigationTitle("HTML in SwiftUI") } } } @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } Now, when I build and run the simple SwiftUI app shown above, it renders just fine, but there is a lot of log entries similar to "=== AttributeGraph: cycle detected through attribute 24504 ===". In addition to that, the navigation title bugs out when I scroll up. It also seems like SwiftUI is not able to detect changes to the HTML View, and does not re-evaluate its body if I re-create HTML with a new bodyText (even though its structural identity is preserved). When I use Instruments to inspect SwiftUI View body invocations, I can see that initiating the inline HTML styled NSAttributedString in the HTML View's body takes several milliseconds (not too surprising as it calls into WebKit stuff?), resulting in HTML.body taking more than 15 milliseconds to complete. Which is a lot more than if i just instantiated a "pure" text string using e.g the NSAttributedString(string:) initialiser. The initial render also seem to call HTML.body twice, a second time after calling the body of some View labeled "RootModifier" (Maybe the invocation of HTML.body took too long, and SwiftUI tries again?). Now, I acknowledge that all these signs yell "do not call computational heavy stuff inside a View's body!", but still, I would love to understand why SwiftUI complains about cycles in its AttributeGraph (as I can't really see any), and why SwiftUI does not re-evaluate HTML's body if I re-create HTML with a new bodyText (as HTML's initialiser is clearly called with a new and different bodyText value). I could also just completely drop the custom HTML SwiftUI View, and just use the AttributedText UIViewRepresentable directly. And then fully manage instances of HTML styled NSAttributedStrings in my model layer (and not instantiate them as part of some custom SwiftUI View). But that would remove some of the abstraction and readability of having a dedicated SwiftUI View for rendering HTML. So any suggestions on how to create such an abstraction/SwiftUI View would be greatly appreciated as well!
3
1
3.3k
Oct ’23
run Javascrip on Safari
Hello, I am experiencing an issue when running a script on Safari, specifically WebKit. Here is a sample HTML code: <!DOCTYPE html> <html lang="en"> <head> <script> function delayedFocus(e) { e.preventDefault(); setTimeout(function() { e.target.focus(); }, 1000); // Adjust the delay time as needed (in milliseconds) } </script> </head> <body> <ul> <li> <input type="text" id="testtext" onmousedown="delayedFocus(event)"> </li> </ul> </body> </html> The logic behind this script is to introduce a 1-second delay when the user clicks on the textbox. After 1 second, the keyboard should appear. Testing on Android mobile devices shows the expected behavior. However, on iPhones, the textbox receives focus, but the keyboard does not appear. This issue has been observed on various iOS versions, with the script working only on iOS 15. If you have any insights or solutions to address this compatibility issue, it would be greatly appreciated. Thank you.
Replies
0
Boosts
0
Views
815
Activity
Feb ’24
Link cant be opened inside iframe
Hi, I have a mobile app that uses iframe to show the html content. I noticed that the link cant be opened on the IOS but its works well on android. Here's general example html code: <iframe id="view-html-viewer-iframe" src="about:blank" frameborder="0"> ... <p><a href="https://google.com/" target="_parent">Google</a></p> ... </iframe> Anyone encounter the same issue.? is there any solution for this.? Thanks.
Topic: Safari & Web SubTopic: General Tags:
Replies
0
Boosts
1
Views
751
Activity
Jan ’24
Table filter in a flask app works fine on Chrome, FireFox, and IE but does not work on Safari
I have a table with a filter. The table only displays the table rows that matches the filter. In the javascript code, I have a filterInteraction() function that have a commonElements list and display the table rows if they are included in the commonElements list. In my html, when the user click, the filterInteraction() will be triggered. Here's part of my filterInteraction() function (the sensitive code is removed): " function filterInteraction(){ let searchList = searchResult(); let checkboxList = checkboxResult(); let commonElements = searchList.filter(element =&gt; checkboxList.includes(element)); console.log("commonElements ==========", commonElements) var table, tr, i; table = document.getElementById("employeeTable"); let rows = table.getElementsByTagName("tbody")[0].getElementsByTagName("tr"); for (i = 0; i &lt; rows.length; i++) { let currentName = rows[i].getElementsByTagName("td")[0].textContent.trim(); if(commonElements.includes(currentName)){ rows[i].style.visibility = "visible"; // rows[i].removeAttribute("hidden"); // rows[i].style.display = ""; } else{ rows[i].style.visibility = "hidden"; // rows[i].setAttribute("hidden", true); // rows[i].style.display = "none"; } } countPart(commonElements.length); }". In this function, I printed the commonElements list, and the list is always correct. However, for the display, it's switching between displaying nothing and displaying the correct rows. (When entering the Safari, the first click on the filter makes the table empty, but the second click displays the correct rows, the next click will make the table displays nothing again .... ). Even during the time that the table display nothing, the commonElements list printed in console is still correct, which means the function does have the correct table rows, but they are not displayed. I tried three different ways to display the table row: "rows[i].style.visibility = "visible"; rows[i].removeAttribute("hidden"); rows[i].style.display = "";". None of them could work without the bug I mentioned above. I tested my filter on Chrome, FireFox, and IE, and my filter works perfectly on them. Any possible way to solve the issue on Safari? Why it has the display bug like this in Safari? Really need help!!! Thanks
Replies
1
Boosts
0
Views
808
Activity
Jan ’24
HTML NSAttributedString technique that avoids Sonoma's TextKit issues
Basic HTML strings do not display correctly on macOS Sonoma, I am wondering if there is an alternative technique that can be utilized. There was a minor change in macOS 14.2, which fixed some cases but made others much worse. Consider the following code: override func viewDidLoad() { super.viewDidLoad() let html = """ <table width="100%" border="1" style="color: white"> <tr> <td align="left">Left</td> <td align="right">Right</td> </tr> </table> """ let data = Data(html.utf8) let definition = try! NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: NSNumber(value: String.Encoding.utf8.rawValue)], documentAttributes: nil) let frameRect = NSRect(x: 100, y: 0, width: 300, height: 200) let textView = NSTextView(frame: frameRect) textView.textStorage?.setAttributedString(definition) textView.backgroundColor = .clear view.addSubview(textView) } On macOS 14 (23A5312d) it looks like this (FB13170237): On macOS 14.2 (23C64) it looks like this (FB13465833):
Replies
1
Boosts
0
Views
1.1k
Activity
Jan ’24
After clicking button while submitting form in "jsp" page, loader is not working properly
Hi, We are facing an issue in our page , The same works fine in other operating systems like android and windows. we are facing this issue only on IOS and MAC(safari browser alone ). We have a loader with us ,which will be shown in 2 different phases in our page. The first time loader will be shown while page is being loaded, the second loader will be shown once the user clicks on pay button. the first loader is not giving any issues for us .But the second loader is not loading completely as you can see in the attached not working image ,the blue circle is being displayed only a 5-10%. It should start from 0 and gradually should reach 100% and again a loop. From the analysis we could see the loader rotates fine after clicking pay button ,but once after page is submitted the issue happens document.paypage.submit(); (code attached below) // this is the form submission in our page // once the control reaches this line we could see the loader is not working fine. the same scenario is checked in android ,but even after page submission the loader works fine, Only in IOS and mac we are facing issue in (safari in mac other browser works fine without any issue), (all browsers in iOS). please direct us to solve the issue Attached images of working and not working scenario Not Working Working Code sample <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Loader</title> <style> .loader { position: relative; margin: 0 auto; width: 100px; &:before { content: ""; display: block; padding-top: 100%; } } .circular { animation: rotate 3s linear infinite; height: 100%; transform-origin: center center; width: 100%; position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; } .background-ring { fill: none; stroke: rgb(227, 226, 231); stroke-width: 5; } .path { stroke-dasharray: 1, 200; stroke-dashoffset: 0; animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite; stroke-linecap: round; } @keyframes rotate { 100% { transform: rotate(360deg); } } @keyframes dash { 0% { stroke-dasharray: 1, 200; stroke-dashoffset: 0; } 30% { stroke-dasharray: 95, 200; stroke-dashoffset: -30px; } 100% { stroke-dasharray: 89, 200; stroke-dashoffset: -124px; } } @keyframes color { 100%, 0% { stroke: rgb(14, 236, 218); } 40% { stroke: rgb(14, 236, 218); } 66% { stroke: rgb(14, 236, 218); } 80%, 90% { stroke: rgb(14, 236, 218); } } body { background-color: var(--white); } .showbox { display: flex; position: absolute; top: 0; bottom: 0; left: 0; right: 0; padding: 5%; } </style> </head> <body> <div class="showbox"> <div class="loader"> <svg class="circular" viewBox="25 25 50 50"> <!-- Background ring --> <circle class="background-ring" cx="50" cy="50" r="22" /> <!-- Loading circle --> <circle class="path" cx="50" cy="50" r="22" fill="none" stroke-width="4" stroke-miterlimit="10" /> </svg> </div> </div> </body> </html>
Replies
0
Boosts
0
Views
902
Activity
Jan ’24
"Google pay button icon" not visible in specific iOS versions
Hi, The below code is used for loading GPay icon dynamically from Google in "WKWebView". The same code works for later versions of IOS like 16.4, but issue happens in 16.1 ,16.2 and 16.3 versions. while loading this code from IOS 16.3 the icon (Gpay icon) is completely black, looks like it's not loaded properly. Please assist us on what can be the issue, and how we can proceed to solve the issue. Not working Working
Replies
0
Boosts
0
Views
936
Activity
Jan ’24
HTML tags in UILabel don't work
Hi, I've got this html text: "<style>* {font-size: 12pt !important;color: #000000 !important;font-family: Montserrat-Regular !important;}</style>Perform the following steps:<br><u>Option 1:</u><br><p>1) Upon receiving a push notification alert, tap on the push notification to launch BIMB Authenticator</p><p>2) Verify the transaction details and choose \"Approve\"</p><p>3) Complete</p><br><u>Option 2:</u><br><ol><p>1) If you didn’t receive push notification, you may launch BIMB Authenticator</p><p>2) Verify the transaction details and choose \"Approve\"</p><p>3) Complete</p>" And I'm trying to show this HTML text properly in a UILabel. This is my codes: String extension to map to NSAttributedString: extension String { func attributedStringFromHTML() -> NSAttributedString? { guard let data = "\(self)" .data(using: .utf8, allowLossyConversion: false) else { Log.error(category: .transaction, message: "Unable to decode data from html string: %@", self) return nil } let options: [NSAttributedString.DocumentReadingOptionKey: Any] = [ .documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue ] if let attributedString = try? NSAttributedString(data: data, options: options, documentAttributes: nil) { return attributedString } else { Log.error(category: .transaction, message: "Unable to create attributed string from html string: %@", self) return nil } } } And this is the result: Can you tell me how to fix this? Thanks.
Replies
0
Boosts
0
Views
961
Activity
Dec ’23
iOS 17 Safari dropped support for #canonicalWebPageURL links?
iOS 17 Safari will not successfully open .reality (Reality Composer) files from a weblink. For example, this code works fine on iOS 16: The same code generates this message on iOS 17 after clicking on the link: "Object requires a newer version of iOS." QuickLook fails to render anything. I validated that the .reality file works fine when opened from iOS 17 Files app, so it's not a damaged file.
Replies
0
Boosts
1
Views
712
Activity
Dec ’23
iOS and iPadOS date pickers ignores min/max date range when opening
In web-based apps we want date pickers to open to a previous month based on the min-max date range specified on the input. We do not want to set a specific day but want the user to select a date. Android devices and Windows OS (Chrome and Edge) all behave as expected, namely, when the calendar loads the first month specified as the min value displays. iOS devices always open the calendar showing the current month and ignore the min/max attributes on the input. Additionally, the current date is selected making it very easy for the use to accidentally choose the wrong date by accidentally closing the date picker. It appears that iOS is the only platform not supporting min/max on date inputs. Will this be fixed? Or is it this by design? For example, today is December 13, 2023, we expect that selecting the following input to open the native calendar displaying November 2023 and to not select a date. <input autocomplete="off" type="date" placeholder="M/d/yy" min="2023-11-01" max="2023-11-30">
Replies
0
Boosts
2
Views
1.5k
Activity
Dec ’23
Weird dark overlay issue in HTML canvas on iOS. 17 and later
Since the update to iOS 17, the pictures in our virtual tours randomly turn very dark and high contrast. They are shown in a canvas so it looks like the entire canvas content is being manipulated. However nothing in our code does this, it happens very randomly (not in every picture and also not in the same pictures every time) and it's only in iOS 17 (not in other iOS versions, not on iPadOs, Mac, Windows, Android, ...). We tried debugging for hours and hours but nothing indicates that this is caused by anything in our code. To try it out yourself: visit https://youreka-virtualtours.be/tours/vyncke_buhler (on mobile of course). Screenshot shows what I mean. Sometime you have to click around randomly. Left screenshot in the side by side is after refresh. You can also see the effect disappears when looking at the browser tabs overview.
Replies
9
Boosts
1
Views
1.7k
Activity
Dec ’23
macOS 14 - NSAttributedString created from HTML displays as "undefined character" glyphs when certain fonts are used
I allow users to choose a font to use throughout the app, then display text using that font in 3 different ways: As the default body font of an HTML document displayed in a WKWebView. Used to create an NSAttributedString then displayed in an NSTextField. Used as the body font of a very small HTML document (2-3 lines), converted to NSAttributedString, then displayed in an NSTextField. My code has been working fine for years, but starting with the release of Sonoma (macOS 14), any text that is converted from HTML to NSAttributedString displays as all "question marks in boxes" for each character. This happens when certain fonts are used. In particular I've seen it with Calibri, Candara, and SF Pro. Calibri and Candara are Microsoft fonts and I think are distributed with MS Office. SF Pro is an Apple font. There could be others; I haven't done an exhaustive check. What I can tell you is that this has been working fine literally until a couple weeks ago when customers began installing macOS 14. If they go into my app and select a different font (such as Arial or Times New Roman) everything works fine. It is only certain fonts that don't work, and those fonts work when used as the body font of an HTML document in WKWebView and when used as the font for a new NSAttributedString. They just don't work if you make a little HTML document with the font selected as the body font, then convert to NSAttributedString. Here's the code that worked up until macOS 14: NSString *htmlString = @"&amp;lt;!DOCTYPE html&amp;gt;" "&amp;lt;html&amp;gt;" "&amp;lt;head&amp;gt;" "&amp;lt;style&amp;gt;" "body { font-family: 'Candara', serif; font-size: 14px; }" "&amp;lt;/style&amp;gt;" "&amp;lt;/head&amp;gt;" "&amp;lt;body&amp;gt;" "This won't display right." "&amp;lt;/body&amp;gt;" "&amp;lt;/html&amp;gt;"; NSData *htmlData = [htmlString dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)}; NSError *error; NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:htmlData options:options documentAttributes:nil error:&amp;amp;error]; Note the fallback of "serif" — that doesn't matter. you get all undefined characters and the fallback font is not used. It's as if the renderer really believes the font is usable, but it isn't.
Replies
1
Boosts
0
Views
1.1k
Activity
Nov ’23
No markup for Markdown in XCode!
The Text inside README.md or any other Markdown files added to the project's bundle, simply are not formatted when previewed in XCode. Almost all of the opensource projects have instructions in Markdown at the top level of the project & even Apple use MD in their sample projects. Magically, the .md files in Apple sample projects are formatted as expected as you can see below, but this isn't the case in any other project. I've also checked the file's settings in the XCode inspector and it didn't differ from the ones existing in the Apple code samples. This is how we are used to view Markdowns in XCode. And this is is the README.md in HappyBeam which is formatted.
Replies
2
Boosts
0
Views
2.2k
Activity
Nov ’23
NSAttributedString doesn't format HTML tables properly on Sonoma
This issue has already been reported to Apple via the Feedback Assistant as FB12401598 and a code-level support incident has been opened to follow up, but so far I haven't heard anything. The problem is that the NSAttributedString used to be able to load HTML files correctly via the [NSAttributedString initWithHTML:options:documentAttributes:] method (or its Swift equivalent). As of the developer beta of Sonoma, however, this no longer works. The method loads the attributedString but HTML tables are completely ignored. Every cell in the table just appears on a new line. The app I'm working on has a bunch of HTML templates that get drawn inside another View using an NSAttributedString. This has worked for years but no longer works on Sonoma. Does anyone know a decent workaround for correctly drawing some formatted text whose formatting is specified via HTML? I'm currently exploring the idea of converting the HTML files to RTF on an older system and using RTF, but the RTF format isn't nearly as simple as HTML. Here's a screenshot of a simple project and Safari showing the same HTML side by side
Topic: Safari & Web SubTopic: General Tags:
Replies
6
Boosts
0
Views
1.9k
Activity
Nov ’23
Data is getting truncated at the page end and displaying other half in next page in a Pdf render. This issue is reproducing only on ios 17 version ipads wheere data is loading with wkwebView.
I need help for this issue which is happening only in ios 17 ipad devices. I have an application which generates report in a pdf form. We are loading the html file as a string to webkit webView which is further helping us by generating the content in pdf format. our report contains rows & columns which uses div tags and few css properties. If we view the report which is in pdf form, the data is getting truncated for a row horizentally at the page end and displaying the remaing truncated data in the next page. This issue is happening only in ios 17 updated devices. It was working fine and displaying the data correctly with same html content. Please let me know any possible ways through which I can resolve this issue. I have tried few properties like page-break-X(inside,before,after)- avoid; margin-bottom, padding etc...nothing worked for me.
Replies
0
Boosts
0
Views
745
Activity
Nov ’23
iOS 17 html5 use LocalStorage Failed
iOS 17 html5 use LocalStorage Failed,other system suceess
Topic: Safari & Web SubTopic: General Tags:
Replies
0
Boosts
0
Views
743
Activity
Nov ’23
Document-based Apple App that can run on iOS, iPadOS, and macOS
I am new to developing native Apple apps and must familiarize myself with the Apple development frameworks. I am starting to create a personal document-based Apple App that can run on iOS, iPadOS, and macOS. The document will contain the following: HTML, PDF, images, video, and audio files. So, I think the document format could be HTML. I need the capability to read, edit (WYSIWYG Editor), save, and share documents with other users using the same app. The data is stored in the user's device and iCloud. I need guidance about what Apple framework I should use to edit the documents using WYSIWYG editing principles. I would really appreciate any recommendation you can provide. Many thanks for considering my request. Thank you so much for your attention and participation.
Replies
2
Boosts
0
Views
1.4k
Activity
Nov ’23
Can't scroll past a video with playsinline attribute inside an iframe [Safari iOS 17.0.3]
I'm loading a page inside an iframe. The page contains a video with the playsinline attribute. The video is completely unresponsive to touch events, meaning if it fills up the screen I can't scroll past it, thus breaking the page. Note the video also has autoplay, loop and muted attributes but these did not cause scrolling issues; only playsinline causes the break. Myself and another tester are running Safari on an iPhone 14 with iOS 17.0.3 and it's broken for both of us. Confirmed with 2 additional testers there is no issue with iPhones running iOS 16.6. Test case: https://codepen.io/gem0303/pen/qBgEeaG Repro steps: Load in Safari on an iPhone with iOS 17.0.3 Tap and drag on the white background and dummy scrolling text -- works fine. Tap and drag on the cat video -- scrolling is impossible.
Replies
4
Boosts
1
Views
2.1k
Activity
Oct ’23
Change colour of scrollbar thumb via CSS in iOS 13
::-webkit-scrollbar-thumb does not work in iOS 13 devices, Need to change thumb colour from black to white for dark background. Tried below solution but not working. ::-webkit-scrollbar-thumb { background: white; } Any suggestions. Thanks
Replies
4
Boosts
0
Views
7.1k
Activity
Oct ’23
Scroll Issues in ios browsers
I am facing an issue in scrollable components as I have a parent component and child component both are scrollable but when I get to the end of my child component then it should scroll the parent component by default but it gets stuck in the child components scroll only. FYI, I am using reactJs if it helps in any case.
Replies
0
Boosts
0
Views
817
Activity
Oct ’23
Instantiating "HTML-styled" NSAttributedString in a View's body produces weird behaviour
In an attempt to expose the capabilities of NSAttributedString in combination with UITextView to the world of SwiftUI (specifically the ability to render basic HTML), I've wrapped UITextView in a UIViewRepresentable and used that in a custom SwiftUI View. But I'm seeing some issues I can't really explain... So I would love to get a deeper understanding of what's going on. And possible also find a way to fix these issues in an appropriate way. This is how it goes: UIViewRepresentable wrapping UITextView to display NSAttributedString in the context of SwiftUI import SwiftUI struct AttributedText: UIViewRepresentable { private let attributedString: NSAttributedString init(_ attributedString: NSAttributedString) { self.attributedString = attributedString } func makeUIView(context: Context) -> UITextView { let uiTextView = UITextView() // Make it transparent so that background Views can shine through. uiTextView.backgroundColor = .clear // For text visualisation only, no editing. uiTextView.isEditable = false // Make UITextView flex to available width, but require height to fit its content. // Also disable scrolling so the UITextView will set its `intrinsicContentSize` to match its text content. uiTextView.isScrollEnabled = false uiTextView.setContentHuggingPriority(.defaultLow, for: .vertical) uiTextView.setContentHuggingPriority(.defaultLow, for: .horizontal) uiTextView.setContentCompressionResistancePriority(.required, for: .vertical) uiTextView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) return uiTextView } func updateUIView(_ uiTextView: UITextView, context: Context) { uiTextView.attributedText = attributedString } } Used in a custom HTML SwiftUI View import SwiftUI struct HTML: View { private let bodyText: String init(_ bodyText: String) { self.bodyText = bodyText } var body: some View { AttributedText((try? NSAttributedString( data: """ <!doctype html> <html> <head> <meta charset="utf-8"> <style type="text/css"> body { font: -apple-system-body; color: white; } </style> </head> <body> \(bodyText) </body> </html> """.data(using: .utf8)!, options: [ .documentType: NSAttributedString.DocumentType.html, .characterEncoding: NSUTF8StringEncoding, ], documentAttributes: nil )) ?? NSAttributedString(string: bodyText)) } } Put together in a simple SwiftUI app import SwiftUI struct ContentView: View { var body: some View { NavigationStack { ScrollView { HTML(""" <p>This is a paragraph</p> <ul> <li>List item one</li> <li>List item two</li> </ul> """) } .navigationTitle("HTML in SwiftUI") } } } @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } Now, when I build and run the simple SwiftUI app shown above, it renders just fine, but there is a lot of log entries similar to "=== AttributeGraph: cycle detected through attribute 24504 ===". In addition to that, the navigation title bugs out when I scroll up. It also seems like SwiftUI is not able to detect changes to the HTML View, and does not re-evaluate its body if I re-create HTML with a new bodyText (even though its structural identity is preserved). When I use Instruments to inspect SwiftUI View body invocations, I can see that initiating the inline HTML styled NSAttributedString in the HTML View's body takes several milliseconds (not too surprising as it calls into WebKit stuff?), resulting in HTML.body taking more than 15 milliseconds to complete. Which is a lot more than if i just instantiated a "pure" text string using e.g the NSAttributedString(string:) initialiser. The initial render also seem to call HTML.body twice, a second time after calling the body of some View labeled "RootModifier" (Maybe the invocation of HTML.body took too long, and SwiftUI tries again?). Now, I acknowledge that all these signs yell "do not call computational heavy stuff inside a View's body!", but still, I would love to understand why SwiftUI complains about cycles in its AttributeGraph (as I can't really see any), and why SwiftUI does not re-evaluate HTML's body if I re-create HTML with a new bodyText (as HTML's initialiser is clearly called with a new and different bodyText value). I could also just completely drop the custom HTML SwiftUI View, and just use the AttributedText UIViewRepresentable directly. And then fully manage instances of HTML styled NSAttributedStrings in my model layer (and not instantiate them as part of some custom SwiftUI View). But that would remove some of the abstraction and readability of having a dedicated SwiftUI View for rendering HTML. So any suggestions on how to create such an abstraction/SwiftUI View would be greatly appreciated as well!
Replies
3
Boosts
1
Views
3.3k
Activity
Oct ’23