JavaScript

RSS for tag

Discuss the JavaScript programing language.

JavaScript Documentation

Posts under JavaScript tag

88 Posts
Sort by:
Post not yet marked as solved
13 Replies
162 Views
We found that canvas of the same size is more blurry in iOS 16 Beta 3. Here's the code: <!DOCTYPE html> <html lang="en"> <head> <title>Document</title> <style> #app { height: 586px; width: 1170px; } </style> </head> <body> <canvas height="586px" width="1170px" id="app"></canvas> <script> const el = document.getElementById('app'); const ctx = el.getContext('2d'); ctx.font = '80px Arial'; ctx.fillText('Hello World', 100, 100) </script> </body> </html> Oddly enough, if you set the height of the code above to 585 px(one pixel less), the text on the canvas becomes clear. This will only happen with iOS Beta 3. ref: https://bugs.webkit.org/show_bug.cgi?id=242847
Posted
by
Post not yet marked as solved
0 Replies
66 Views
I have one web viewer in React Native for my app, and the function of translate with Google works perfectly in the Safari browser, in my Android App, and on the desktop, but not in the iOS app This is my Google Translate code: function googleTranslateElementInit() { new google.translate.TranslateElement({ pageLanguage: 'pt', includedLanguages: 'pt,en,es', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL }, 'google_translate_element'); comboTranslate = document.querySelector("#google_translate_element .goog-te-combo"); } function changeEvent(el) { if (el.fireEvent) { el.fireEvent('onchange'); } else { // var evObj = document.createEvent("HTMLEvents"); var event = new Event('change'); comboTranslate.dispatchEvent(event); // evObj.initEvent("change", false, true); // el.dispatchEvent(evObj); } } function changeLang(lang) { if (comboTranslate) { comboTranslate.value = lang; changeEvent(comboTranslate); } } function clickChange(){ btn_translate = document.querySelectorAll('.language'); // o que faz os menus acender; btn_translate.forEach(btn =&gt; { btn.addEventListener('click', function (e) { var lang = e.srcElement.getAttribute('data-language'); changeLang(lang) }) }) } clickChange(); setTimeout(() =&gt; { googleTranslateElementInit() // comboTranslate.addEventListener('change', function (e) {alert('a');}) }, 500); and on the app.json I have: { "expo": { "name": "MyApp ", "slug": "MyApp", "version": "1.2.0", "orientation": "portrait", "icon": "./assets/icon.png", "locales": { "en": "./locales/ios/en.json", "pt": "./locales/ios/pt.json", "es": "./locales/ios/es.json" }, "platforms": [ "ios", "android" ], "splash": { "image": "./assets/splash.png", "resizeMode": "contain", "backgroundColor": "#ffffff" }, "plugins": [ [ "expo-notifications", { "icon": "./assets/icon.png", "color": "#ffffff" } ] ], "updates": { "fallbackToCacheTimeout": 0 }, "assetBundlePatterns": [ "**/*" ], "ios": { "buildNumber": "8", "supportsTablet": true, "bundleIdentifier": "com.myapp", "infoPlist": { "CFBundleAllowMixedLocalizations": true } }, "android": { "package": "com.myapp", "versionCode": 9, "googleServicesFile": "./google-services.json", "config": { "googleMaps": { "apiKey": "AIzaSyDQjE4F3chI8Jy4FA8h45LqA7bMfngoH7Y" } }, "permissions": ["ACCESS_COARSE_LOCATION", "ACCESS_FINE_LOCATION", "CAMERA", "RECORD_AUDIO"], "blockedPermissions": ["ACCESS_BACKGROUND_LOCATION"], "adaptiveIcon": { "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#FFFFFF" } }, "notification": { "icon": "./assets/icon.png" } } } I put console.log and alerts to see if the change in the select element of languages is being triggered by the JS, and it's all ok, I really don't know why it is not translating.
Posted
by
Post not yet marked as solved
0 Replies
142 Views
Hi. The registration process with WebAuthn works fine and expected. As we use the same code on both android and ios, we dont use discoverable credentials, but instead saves the credential-id in a cookie. If an user deletes his cookie, we can not see if the user has registered previously without prompting the user for registration again. This is okay, and if we get an InvalidStateError (because the user is already registered) we let the user think he has registered again, and just creates a new cookie. The problem is: When the navigator.credentials.create is called, the InvalidStateError is catched immideately, before the user have time to do anything about the faceID prompt which shows. When the InvalidStateError is caught, the Registration Completed page shows. This means the completed page is shown behind the face-id prompt, which is very confusing for the user. How can the registration be completed if the face-id prompt is not finished? On Windows, the error is not thrown before the user has completed the faceid prompt, which means the registration-process is experienced exactly as a first-time registration. Is it a bug that the prompt is shown after the error is thrown? Any tips to how i can work around this? If this is not the right forum to ask - where is a better place? Best regards, Nina
Posted
by
Post not yet marked as solved
0 Replies
137 Views
I built a simple recorder on my website for users to record and playback audio. It works on ALL desktop browsers (including Safari) but when I use any browser on my iPhone, the mic is active at the opposite time. The flow is: ask permission > user allows mic access > user presses record > records audio > saves and plays back On iPhone what's happening is after the user allows permission, the mic goes active (visualized by the mic icon in safari browser) and then once the user presses record, it disables the mic. I am using getUserMedia within a React.js app Why is it doing this?
Posted
by
Post not yet marked as solved
0 Replies
128 Views
When triggering a webkitRequestFullscreen event in response to a pointerdown event, the result is a fullscreen error. Using a pointerup event instead of pointerdown works fine. I'm using a <button> element to receive the event and in the event listener callback I'm attempting to call webkitRequestFullscreen() on a div. Is this expected behavior? note: this was observed using MacOS Simulator: iPad 9th Generation - iOS 15.4
Posted
by
Post not yet marked as solved
0 Replies
125 Views
Hello, i would like to know if anyone knows how the Tik Tok button to works to share a video from this plataform in Instagram stories, that is, the button opens editing mode with the video already included. I would be needing to make a similar button for an application. i tried entering URLs from my phone like: "//instagram.com/create/story" but it doesn´t even open the story editing mode. Thank you very much.
Posted
by
Post not yet marked as solved
1 Replies
229 Views
Date objects should be able to be constructed with strings formatted as YYYY-MM-DD . On Chrome-based browsers, both of the following are valid: new Date("2022-06-01") new Date("2022-6-01") although the second one does not strictly follow the format. However, it is extremely convenient to work with since you do not have to check for the string length and determine whether to add a 0 in the beginning. Yet, on my Safari browser, the code: new Date("2022-6-01") returns a date object of an invalid date. This is simple to fix, yet it poses an inconvenience during development. Is there any way to let Apple improve its JavaScript engine?
Posted
by
Post not yet marked as solved
0 Replies
122 Views
We have implemented two sliders in a website "website url-Perennial? Seasonal? Always special (duckstein.de)". These slider are working properly on android devices and other windows browsers. But why these sliders are not working in safari? Please help on it for a solution.
Posted
by
Post not yet marked as solved
9 Replies
533 Views
I have an app built using python with pyinstaller. I was able to successfully get the app notarized and open it on my computer as well as a different one (OS 11.6.1). I can also get the pkg successfully notarized, but when I attempt to launch it on my own computer (or a different one), an error box immediately appears stating "There was an error reading the package" along with "JavaScriptError." I looked at the log file corresponding to the notarization, and I saw no error messages or warnings. Neither "java" nor "javascript" appear anywhere. This was not a problem for me a couple weeks ago when using a slightly different version of my program. Is there a different log file of some type, associated with javascript, that might shed light on the problem? Update: I did just try to check whether package passed the gatekeeper test by typing spctl -a '/Users/..../application.pkg' at the terminal, which returned "rejected"
Posted
by
Post marked as solved
1 Replies
546 Views
Hello Safari 15.4 window.open freezes both parent and child tabs Made a github page where you can reproduce the bug: https://swanty.github.io/pdfjs-safari/broken.html It happens only when special conditions are met: The broken.html page loads Stripe v3 js file (important for the freeze) Upon clicking CLICK ME the code executes window.open().location = '...';, thus both parent and child tabs are linked together in the same process The second page opens the latest release of mozilla pdf.js that loads .pdf that contains only 1 image (the image is important for the freeze) Image is simply 3000x3000 PNG, 1 color, 1.2 kB file created with photopea, nothing special, except the resolution. PDF I created by dragging the .png into Chrome and clicking Print -> Save as pdf, also nothing special, just a regular pdf. On our production web if I navigate pages in same tab and at any point that stripe JS is loaded and then I navigate to a different page where window.open().location = '...' opens that pdf.js + .pdf file with special image then both tabs freeze. It doesn't matter how many times I navigate the pages (in same tab), it seems that once the stripe js is loaded, it lingers in the tab memory somewhere and causes the freeze. I would really appreciate it if someone from the Safari developer team could take a look at this and help find a solution :) Thank you
Posted
by
Post not yet marked as solved
1 Replies
210 Views
I was working on a project where I used the HTMLAudioElement to record an audio response. While playing the audio on iPhone, I noticed that the sound came just from the ear speaker and not the loud speaker which is desired by the user. Is there a way to select the output to come out of the loud speaker as in the former case the user can't hear the preview audio properly?
Posted
by
Post not yet marked as solved
0 Replies
349 Views
When I am applying the CSS property "position: fixed" on the body a white space appears at the bottom of the screen. steps to reproduce the issue: open any page on ios safari hide the address bar by scrolling up apply css property position fixed on body You will see the extra space at the bottom of the screen. This area will be filled with address bar if the address bar is open.
Posted
by
Post not yet marked as solved
0 Replies
184 Views
Hi, I am working on safari web extension for iOS, Since Message passing is only supported from safari extension to iOS application. To pass the data from app to safari extension, I thought of storing the required data using the Userdefault suite name and "app group" to access the UserDefaults data from the safari extension. I am stuck at how to access the data at the safari extension. Any sample javascript to access the UserDefaults data is appreciated Thanks
Posted
by
Post marked as solved
2 Replies
227 Views
Hello, I would like to know if there is a way to disable the focus on a new added annotation on mapkit js. I have a loop that display annotation and every time the new annotation shows up, the map move the camera and set a super-dupper zoom on the new annotation. This is very annoying. Map initialisation : var map = new mapkit.Map("map", { region: region, showsCompass: mapkit.FeatureVisibility.Hidden, showsZoomControl: true, showsMapTypeControl: true, showsUserLocation: true, }); _ New annotation : chasseur = new mapkit.Coordinate(48.8607, 2.3421); ChasseurAnnotation = new mapkit.MarkerAnnotation(chasseur, { color: "#001788", title: "Chasseur", glyphText: "\u{1F6A8}" // POLICE }); map.showItems([ChasseurAnnotation]); _ Thanks a lot for your further responses.
Posted
by
Post not yet marked as solved
0 Replies
139 Views
I want to get user's dictation content and do something. However, during dictation progress, system will continuously trigger 'input' DOM event with duplicated strings. It is impossible to know whether the dictation progress is end to get the final result. Several solutions here: provide specific field, like dictationStatus: end in input event params. trigger composition event instead of input event trigger specific DOM event when user presses on the dictation button. trigger input event only with latest recognized string. for example, I say " I like apple" will get 3 events with strings: "I" "like" "apple" ( not "I" "I like" "I like apple")
Posted
by
Post not yet marked as solved
0 Replies
230 Views
I recently converted my Chrome extension to a Safari extension using the Apple Conversion tool (XCode CLI). The extension is developed with ReactJS and SaSS. It works very well on Google Chrome but when I try it on Safari after converting it, the local extension works but the CSS file that handles the extension is not applied. There are no errors during the conversion but the Safari developer tool indicates several errors : console tab : Failed to load resource: You are not allowed to access the required resource. network tab : An error occurred while trying to load the resource and the resource was requested in an insecure manner. In the extension, we isolate CSS using iframe : /*global chrome*/ /* src/content.js */ import React from 'react'; import ReactDOM from 'react-dom'; import Frame, { FrameContextConsumer }from 'react-frame-component'; import "./content.css"; class Main extends React.Component { render() { return ( <Frame head={[<link type="text/css" rel="stylesheet" href={chrome.runtime.getURL("/static/css/content.css")} ></link>]}> <FrameContextConsumer> { // Callback is invoked with iframe's window and document instances ({document, window}) => { // Render Children return ( <div className={'my-extension'}> <h1>Hello world - My first Extension</h1> </div> ) } } </FrameContextConsumer> </Frame> ) } } Here is the manifest.json file: { "short_name": "My Extension", "name": "My Extension", "version": "1.0", "manifest_version": 3, "icons": { "16": "icon16.png", "48": "icon48.png", "128": "icon128.png" }, "action": { "default_icon": { "16": "icon16.png", "48": "icon48.png", "128": "icon128.png" }, "default_title": "" }, "background": { "service_worker": "background.js" }, "content_scripts" : [ { "matches": ["<all_urls>"], "css": ["/css/root.css"], "js": ["/static/js/content.js"] } ], "permissions": [ "activeTab", "scripting", "storage" ], "host_permissions": ["https://www.google.com/*"], "web_accessible_resources": [{ "resources": [ "/static/css/content.css", "/static/media/*" ], "matches": ["<all_urls>"] }] } After many attempts, I did not understand the exact origin of the problem and I do not know how to solve it. Do you have any suggestions ?
Posted
by
Post not yet marked as solved
1 Replies
323 Views
I want to install a GitHub repository and nvm command therefore I need the java virtual machine. When I check the "java -version in zsh I always get this Error Error: Could not create the Java Virtual Machine. What would you suggest since it is installed JavaVirtualMachines/jdk-18.0.1.jdk?
Posted
by