JavaScript

RSS for tag

Discuss the JavaScript programing language.

Posts under JavaScript tag

200 Posts

Post

Replies

Boosts

Views

Activity

Local Safari extension can't access CSS file
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 ?
1
2
1.2k
Apr ’22
Safari Crashing whilst using Selenium WebDriver
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
0
0
1.1k
Apr ’22
JavaScript browser API
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.
1
0
675
Mar ’22
MusicKit JS webplayer
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?
1
0
1k
Mar ’22
Will my app be rejected if I use javascript to generate dynamic UI?
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.
1
0
1.4k
Mar ’22
iOS Safari App extension loading HTML from internal domain
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.
0
0
903
Mar ’22
Safari trunctates base64 string representing an image
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>
1
0
2.5k
Mar ’22
Open javascript popup in WKWebView?
I have a WKWebView in my app which opens a page where there is a button that uses javascript to open another page with window.open(). Now it's seems that webView(navigationAction) is never called when tapping this button. I have managed to get target="_blank" links to open, but I don't understand how I can get window.open() to work? I have added a uiDelegate to create popup windows like this: public class WKWebVC: UIViewController { &#9;... &#9;override public func viewDidLoad() { &#9;&#9;super.viewDidLoad() &#9;&#9;webView.navigationDelegate = self &#9;&#9;webView.uiDelegate = self &#9;&#9;webView.configuration.preferences.javaScriptEnabled = true    webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true &#9;... and then the extension for WKWebVC: extension WKWebVC: WKUIDelegate {   private func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {     debugPrint("(👉🏽👉🏽👉🏽 createWebViewWith")     popupWebView = WKWebView(frame: view.bounds, configuration: configuration)     popupWebView!.autoresizingMask = [.flexibleWidth, .flexibleHeight]     popupWebView!.navigationDelegate = self     popupWebView!.uiDelegate = self     view.addSubview(popupWebView!)     return popupWebView!   }   private func webViewDidClose(_ webView: WKWebView) {     if webView == popupWebView {       popupWebView?.removeFromSuperview()       popupWebView = nil     }   } } But createWebViewWith is never called either...
2
2
12k
Mar ’22
Safari screen capture pause event handling
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
0
0
846
Feb ’22
Website Loading Problems when using a device with Backup
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
0
0
608
Feb ’22
Setting background-color property of an HTML element with children in Safari iOS 15 doesn't work without manually redrawing the DOM element
The following way of setting the background color of an anchor tag in Safari on iOS 15 isn't working: <html> <head></head> <body><p><a class="content" href="#"><strong><span>Some content with background</span></strong></a> </p> <br /> <button onclick="javascript:onClick();">Click me to change content's background color</button> <script> function onClick(){ var element = document.getElementsByClassName('content')[0]; element.style.backgroundColor = "#888888"; } </script> </body> </html> I had to run the following hack after setting the backgroundColor in order for it to work: // Temporary workaround to redraw the element: var disp = element.style.display; element.style.display = 'none'; var trick = element.offsetHeight; element.style.display = disp; Video demonstration: https://www.dropbox.com/s/2z4kmsypj4ov4sd/iOS%2015%20webkit%20bug.mov?dl=0 Surely this is a bug in Safari unless I might've missed something?
1
0
3.2k
Feb ’22
Copy\Duplicate a file with AppleScript (javascript)
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/" })
0
0
916
Feb ’22
Java on Safari
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)
0
0
540
Jan ’22
How to send subtitles vtt when AirPlay a mp4?
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?
0
0
1.4k
Jan ’22
Cookies with captive portal (CNA)
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?
0
0
1.1k
Jan ’22
Local Safari extension can't access CSS file
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 ?
Replies
1
Boosts
2
Views
1.2k
Activity
Apr ’22
Apple Pay button redirect
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?
Replies
0
Boosts
0
Views
812
Activity
Apr ’22
JavaScript code causing browsers to hang or not load at all
I’m in a web dev program and since yesterday my js code causes chrome, ff and safari to freeze and crash. Chrome task manager shows cpu at 100+. On m1 Mac mini and air
Replies
0
Boosts
0
Views
360
Activity
Apr ’22
Monterey Beta: Safari hanging on certain sites unless JavaScript disabled
As the title suggests: Safari on Monterey Beta 5 hangs on certain sites unless JavaScript is disabled. M1, safe mode, clean re-installs of everything, latest build of the STP, running latest JDK for good measure. It's annoying – anyone else seen this?
Replies
2
Boosts
0
Views
1k
Activity
Apr ’22
Safari Crashing whilst using Selenium WebDriver
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
Replies
0
Boosts
0
Views
1.1k
Activity
Apr ’22
JavaScript browser API
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.
Replies
1
Boosts
0
Views
675
Activity
Mar ’22
MusicKit JS webplayer
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?
Replies
1
Boosts
0
Views
1k
Activity
Mar ’22
Will my app be rejected if I use javascript to generate dynamic UI?
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.
Replies
1
Boosts
0
Views
1.4k
Activity
Mar ’22
iOS Safari App extension loading HTML from internal domain
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.
Replies
0
Boosts
0
Views
903
Activity
Mar ’22
Safari trunctates base64 string representing an image
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>
Replies
1
Boosts
0
Views
2.5k
Activity
Mar ’22
Open javascript popup in WKWebView?
I have a WKWebView in my app which opens a page where there is a button that uses javascript to open another page with window.open(). Now it's seems that webView(navigationAction) is never called when tapping this button. I have managed to get target="_blank" links to open, but I don't understand how I can get window.open() to work? I have added a uiDelegate to create popup windows like this: public class WKWebVC: UIViewController { &#9;... &#9;override public func viewDidLoad() { &#9;&#9;super.viewDidLoad() &#9;&#9;webView.navigationDelegate = self &#9;&#9;webView.uiDelegate = self &#9;&#9;webView.configuration.preferences.javaScriptEnabled = true    webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true &#9;... and then the extension for WKWebVC: extension WKWebVC: WKUIDelegate {   private func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {     debugPrint("(👉🏽👉🏽👉🏽 createWebViewWith")     popupWebView = WKWebView(frame: view.bounds, configuration: configuration)     popupWebView!.autoresizingMask = [.flexibleWidth, .flexibleHeight]     popupWebView!.navigationDelegate = self     popupWebView!.uiDelegate = self     view.addSubview(popupWebView!)     return popupWebView!   }   private func webViewDidClose(_ webView: WKWebView) {     if webView == popupWebView {       popupWebView?.removeFromSuperview()       popupWebView = nil     }   } } But createWebViewWith is never called either...
Replies
2
Boosts
2
Views
12k
Activity
Mar ’22
Safari screen capture pause event handling
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
Replies
0
Boosts
0
Views
846
Activity
Feb ’22
Detect SafariServices or Safari Browser
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..
Replies
0
Boosts
0
Views
807
Activity
Feb ’22
Website Loading Problems when using a device with Backup
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
Replies
0
Boosts
0
Views
608
Activity
Feb ’22
Setting background-color property of an HTML element with children in Safari iOS 15 doesn't work without manually redrawing the DOM element
The following way of setting the background color of an anchor tag in Safari on iOS 15 isn't working: <html> <head></head> <body><p><a class="content" href="#"><strong><span>Some content with background</span></strong></a> </p> <br /> <button onclick="javascript:onClick();">Click me to change content's background color</button> <script> function onClick(){ var element = document.getElementsByClassName('content')[0]; element.style.backgroundColor = "#888888"; } </script> </body> </html> I had to run the following hack after setting the backgroundColor in order for it to work: // Temporary workaround to redraw the element: var disp = element.style.display; element.style.display = 'none'; var trick = element.offsetHeight; element.style.display = disp; Video demonstration: https://www.dropbox.com/s/2z4kmsypj4ov4sd/iOS%2015%20webkit%20bug.mov?dl=0 Surely this is a bug in Safari unless I might've missed something?
Replies
1
Boosts
0
Views
3.2k
Activity
Feb ’22
Copy\Duplicate a file with AppleScript (javascript)
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/" })
Replies
0
Boosts
0
Views
916
Activity
Feb ’22
Java on Safari
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)
Replies
0
Boosts
0
Views
540
Activity
Jan ’22
Mobile Safari & IndexedDB & ServiceWorker
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?
Replies
1
Boosts
0
Views
1.6k
Activity
Jan ’22
How to send subtitles vtt when AirPlay a mp4?
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?
Replies
0
Boosts
0
Views
1.4k
Activity
Jan ’22
Cookies with captive portal (CNA)
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?
Replies
0
Boosts
0
Views
1.1k
Activity
Jan ’22