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
0 Replies
168 Views
I'm in the need to know if it's possible to add a different action to an apple pay button instead of performing the checkout. In this case, I need to request for login (redirect) before performing purchases. Is this allowed by Apple?
Posted
by
Post not yet marked as solved
0 Replies
261 Views
I´ve been creating a automatic Instagram Login for the past few days now but now I have encountered my probably biggest problem. Whenever I try to click on the "Not now" Button automatically for Remembering my Password on Instagram, which it does , Safari Crashes completely, not only the automatically processed tabs even the ones no Program is using. This is the code I use to press the "Not now" Button: new WebDriverWait(driver, Duration.ofSeconds(10)); WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); WebElement Nichtjetzt = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//button[text()='Not Now']"))); WebElement Notnow = driver.findElement(By.xpath("//button[text()='Not Now']")); ((JavascriptExecutor)driver).executeScript("arguments[0].click();",Notnow); When I now try to execute the Method it will press only essential cookies fill out my username and password and press the login button , but then when it gets to the Press Not now button it will press it and immediately crash. This will then be the Error Code: Safari Error Code Question Ending
Posted
by
Post not yet marked as solved
1 Replies
369 Views
I would like to create a web app where you can drag and drop emails from Apple Mail (on macOS). When you drag emails to the desktop an .eml file is created, but when you drag emails to the browser no file is being transferred, I can only get the mail’s subject. So is it possible to drag and drop emails from Apple Mail to browsers? And if yes, then how? So far I've tried chrome and safari, but neither got any files with the dragged element. On windows with outlook or thunderbird this wasn’t an issue, so I hope it can be done with apple mail as well. Thanks in advance
Posted
by
Post not yet marked as solved
1 Replies
261 Views
This is pretty complex to explain in details. But basically, we have an app that is allow our customer to manage their employees. The app main flow is written in Swift already. But each customer have different / unique business model that they require the app to allow them have some custom pages to input their complex data beside the main flow (which is written in Swift) Let's say the current flow for managing a flow data will look like this in our core app: Page A -> Page B -> Page C And they want something like: Page A -> Custom Page A.1 -> Page B -> Custom Page B.1 -> Page C And every customers have different flow and UI. That's why we're creating our own framework that allow customer to embed their own developed UI via Javascript (React Native), which will generate a virtual DOM and render the native UI for their custom pages. The idea is very similar with this: https://github.com/microsoft/react-native-code-push The only difference is we don't use this to push code changes for our main flow, but for each customer, after they login will have additional flow (custom pages) we need to show. So these javascript files will be downloaded remotely after the user is login, and we will run these javascript files to generate their custom forms (base on React native framework). On technical perspective, it's seem possible so far. The only problem is we don't know if Apple allow such implementation or not. But I don't think this will violate Apple's policy since the javascript will only generate virtual DOM that will generate dynamic UI.
Posted
by
Post not yet marked as solved
0 Replies
306 Views
Hello, I would like to have some fringe information about ioS Safari App extensions. My need is passing some HTML to the iOS Safari browser so a new tab or window is opened and the HTML rendered (and its Javascript executed, if any). Being that this is not possible directly, and said that I need that the HTML is handled by Safari and not by a WKWebView or by a SFSafariViewController inside my app, I thought about using an app extension. This seems to be cumbersome, especially for the reaasons described here: https://www.wildfire-corp.com/blog/to-apple-your-new-mobile-safari-extensions-are-great-can-opting-in-be-made-easier I do not know if something has changed or will change, I did not dive in the extension development yet. My idea is creating an extension with access to only a special domain, like html.myapp The url would be https://html.myapp/37h238rd83dt2d2tr8fai33cf When my app wants to open an url like that, Safari should open a window and start the extension, right? open(url,options:options,completionHandler:handler) The url contains a sort of query parameter that is a long string (bas64?) representing the entire HTML code, or a sort of unique ID. The script has to display the HTML after extracting it from the url, or read some shared data between the app and the extension based on the ID. After this point no other interaction is needed between the app and the app extension. I would like to know if the Safari browser in fact can open the new window just on behalf of a special url like the above mentioned one, that is, an url that does not point to a real web page, being that the domain is somehow "fake", although authorised from the Info.plist file. The domain is just for enabling Safari to receive the entire url with HTML string or the unique ID. So would the iOS Safari browser open the window, start the script and then display the HTML? And would all this be allowed by the submission review process? Thanks in advance, Regards PS I know that it was better that Apple allows to pass securely some HTML from a registered iOS app to Safari, instead of this workaround, even with special info.plist keys, certificates or something like that.
Posted
by
Post not yet marked as solved
1 Replies
450 Views
I am writing a web server and testing with Safari. The server is written in Go. I have a page which allows the user to upload an image. The image displays properly in Safari. The image data is in a base64 string. This is on an input tag in the HTML. The save button submits this image along with other inputs. If the string length is over about 500K, when the request arrives at the server, the image string has been truncated which then produces an error EOF when attempting to decode the image. I have used the web inspector to see if I can find an issue there, but everything appears normal. If I select an image of less than around 500K, it is shown fine in the browser and the data string is fine when it arrives at the server. The image upload is accomplished by an input button of type "file" which onchange() executes this javascript code: function processFile(imageInput) { const reader = new FileReader() reader.addEventListener("load", () => { uploaded_image = reader.result; let displayImage = document.querySelector("#display_image"); displayImage.style.backgroundImage = `url(${uploaded_image})`; document.querySelector("#display_image_data").value = uploaded_image; document.querySelector("#display_image_size").innerHTML = uploaded_image.length.toString(); }); reader.readAsDataURL(imageInput.files[0]); } The display_image_data element is <input id = "display_image_data" name = "photoBytesString" hidden>
Posted
by
Post not yet marked as solved
1 Replies
323 Views
Is there any way to grant access to JavaScript browser API like tabs: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs#tabs for safari app extension? For web extension it is done in manifest.json. But I can't find a way to do it for app extension.
Posted
by
Post not yet marked as solved
0 Replies
283 Views
Greetings to all fellow front-end coders. I have quite a headache because of Apple's autoplay policy. As you've probably experienced, you can't autoplay a video / audio element with sound without user interaction. (I'm referring to this) I'm currently trying to create my own music web application that will support playlists. I work with the Next.js framework and use react-player as player. Since it does not natively support playlists, I created a two-player pendulum system, where one plays the current sound file and the other loads the next. Then their roles change. Everything works great in all browsers, except those on iOS, because this player uses autoplay to start playing. I've been worried about this for several days. I've already thought about letting an Apple product users press play button every time a song changes as a punishment, but of course it's not a good solution. I think a lot of you have encountered this and you have certainly found a solution. Please help me :(
Posted
by
Post not yet marked as solved
0 Replies
311 Views
Hi, I'm working on screen recording in Safari. After permission prompted and recording started I see red icon with "screens" next to search bar and the same icon but with white color in tray. After clicking on such icon I can see "pause" option. Is it possible to catch event from that action or disable such option at all? PS. Different icon appears in case when I try to record from camera or just from microphone but with same "pause" option. Screenshots are attached Thanks
Posted
by
Post marked as solved
6 Replies
1.4k Views
I'm seeing an issue with a PWA when added to the home screen. The Keyboard will eventually stop opening. when clicking on an input field. this happens with bmw.com, instagram.com. Once it happens on one PWA, all PWA's are effected. Is this a known issue?
Posted
by
Post not yet marked as solved
0 Replies
300 Views
Hello all! Is there a way to detect with JavaScript if the website runs inside the iPhone's Safari Browser or inside an application SafariServices? I found scripts but it detect WebView or not. What I want to is detect SafariServices. Any suggestion or solution would be great! Thanks..
Posted
by
Post not yet marked as solved
0 Replies
274 Views
We are currently facing a problem with our homepage (https://www.medienwerft.de/), which only occurs when the device is using a backup from an old device. In this case the website has problems with loading headlines, sliders and other elements. Has anyone encountered problems like this before and knows how to solve them? I will attach some screenshots, that depict the mentioned problems and the device information. Thank you in advance. Video not loading headlines on images not loading slider not loading scroll elements content not loading device information
Posted
by
Post not yet marked as solved
0 Replies
321 Views
Hello, I am trying to copy files using AppleScript(javascript) and for the life of me cannot figure out the correct syntax. I have tried all the possible variations i can think of the following but nothing seems to work. Any suggestions would be greatly appreciated!. var app = Application.currentApplication() app.includeStandardAdditions = true // Tried this app.duplicate("/tmp/file1.txt"), {   to: "/tmp/file2.txt" }) // And all sorts of variations such as app.duplicate(Path("/tmp/file1.txt"), {   to: Path("/tmp/file2.txt") }) // And not including file names app.duplicate("/tmp/file1.txt"), {   to: "/tmp/" })
Posted
by
Post not yet marked as solved
0 Replies
259 Views
I am on MacOS 12.1 and on safari java script is enabled in the preferences still the sites that require java are not working. On the terminal: ~ % java -version java version "1.8.0_321" Java(TM) SE Runtime Environment (build 1.8.0_321-b07) Java HotSpot(TM) 64-Bit Server VM (build 25.321-b07, mixed mode)
Posted
by
Post not yet marked as solved
0 Replies
402 Views
Target is view html subtitles in vtt format in TV when AirPlay is running from: <video preload="metadata" x-webkit-airplay="allow" src="a.mp4"> <track kind="subtitles" default="" src="en.vtt" srclang="en"> <track kind="subtitles" src="de.vtt" srclang="de"> <track kind="subtitles" src="es.vtt" srclang="es"> <track kind="subtitles" src="fr.vtt" srclang="fr"> </video> The problem is when AirPlay is enabled video and audio plays on TV, but no subtitles showed. I tryied to include vtt/srt subtitles into the mp4 metadata with ffmpeg and subtitles working with VLC but not working when AirPlay this files. ffmpeg -i 8499.mp4 -i 8499.en.vtt -map 0:v -map 0:a -c copy -map 1 -c:s:0 mov_text -metadata:s:s:0 language=en 8499.en.mp4 ffmpeg -i 8499.mp4 -i 8499.en.srt -map 0:v -map 0:a -c copy -map 1 -c:s:0 srt -metadata:s:s:0 language=en 8499.en.mp4 Also tried to send a .m3u8 with no luck. Any of you know how is the basic format for a simple .m3u8 with a .mp4 and .vtt working when AirPlay? Wich is the standard subtitles solution for AirPlay?
Posted
by
Post not yet marked as solved
0 Replies
377 Views
Hello, why i cant access to IndexedDB data, created by serviceworker, from DOM? It is different databeses? On all other browsers i can save data in ServiceWorker into IndexedDB and read it in Dom from IndexedDb with same name, But it not work on Mobile Safari, for what it not shared now?
Posted
by
Post not yet marked as solved
0 Replies
274 Views
Hi I'm developing a captive portal with cookies, it works fine in devices like Macs, laptops and android devices but cookies don't work on iPhone. I'm creating cookies in js with document.cookie but the problem is when I connect my iPhone and close CNA, it destroy them and next time I try to connect, cookies don't exist anymore. Someone can help me to figure out how can I avoid CNA destroy my cookies?
Posted
by
Post not yet marked as solved
1 Replies
878 Views
My website shows a video using video tag which worked perfectly until not long ago. The video is working but when pressing on full screen, the video is playing but the screen is black while the sound is still playing. The issue occurs only on iPhones with iOS 15 (using Safari and Chrome also). Things I've tried: I've tried playing the video directly with a URL to the actual file(to check its not codec issue) and it worked properly. My video tag has 'position: absolute;' on it and I tried removing it(even though it breaks my layout) and that didn't work either. Tried pausing the video immediately and playing it after the video loads. Tried applying a background: white; or any non-transparent color to the video tag. Tried removing auto play. Tried to disable 'GPU process: Media' on safari settings just to check if that affects anything and it didnt. This is the html: <video data-test-id="long-video" #longVideo muted controls playsinline [class.d-none]="!isShortVideoHidden" *ngIf="isPageLoaded" src="https://cdn1.someurl.com/videos/commercial_1.mp4" type="video/mp4"> </video> and the css(with the parent): @media only screen and(min-width:992px) { .fixed-video { position: fixed; z-index: 10000; margin: auto; width: 100vw; height: 100vh; left: 0; top: 0; bottom: 0; right: 0; background: rgba(0, 0, 0, 0.5); transition: 0.4s; video { width: 80%; left: 0; right: 0; top: 0; bottom: 0; margin: auto; } } } Please tell me if you have struggled with this and know how to solve it. Thank you :)
Posted
by
Post not yet marked as solved
1 Replies
529 Views
I am trying to create a webplayer for apple music and have run into some issues with actually playing the music. authorized.then((res) => { console.log(res); musicInstance.setQueue({ song: '1025212395' }).then((queue) => { console.log(queue) musicInstance.play(); }); },(rej) => { console.log("Failed to Recieve User Authorization") }) where authorized is the promise that is returned when the user logs in. I keep getting the following console errors when attempting to play any sort of media and have no clue how to debug it. Sometimes, it says DOM error and mediasource readyState is not 'open' Any ideas?
Posted
by