Safari Developer Tools

RSS for tag

Inspect, edit, debug, and check the performance of your web content using Safari developer tools.

Safari Developer Tools Documentation

Posts under Safari Developer Tools tag

99 Posts
Sort by:
Post not yet marked as solved
0 Replies
412 Views
I am trying to make a safari extension that will redirect some specific URLs to some other URLs. background.js function redirect(event) { console.log("called ") const redirectURL = "https://apple.com/" chrome.tabs.update(event.tabId, { url: redirectURL }) } // This works and redirects everything to apple.com chrome.webNavigation.onBeforeNavigate.addListener(redirect) /* tabs.update doesn't work as soon as URL filter is added, but the same piece of code works in a chrome extension but not in safari OnBeforeNavigate is called on accessing girlcodeit.com as the console statement is printed on accessing girlcodeit.com but tab is not updated. */ chrome.webNavigation.onBeforeNavigate.addListener(redirect, { url: [ { urlMatches: "https://girlcodeit.com/*" }, { urlMatches: "http://girlcodeit.com/*" } ] }) manifest.json "manifest_version": 2, "name": "", "description": "", "version": "1.0", "background": { "scripts": [ "background.js" ] }, "permissions": [ "webNavigation", "tabs" ] } How do I redirect only specific URLs and not all URLs or is there something wrong with the above piece of code, but because it works on chrome, it could be a bug in safari?
Posted
by mt2107.
Last updated
.
Post not yet marked as solved
1 Replies
777 Views
Hello, I have a very strange problem, only on safari. I have set up cross-origin access on my api, and it doesn't only work on safari. More exactly, if during the call I do not pass headers, it works: fetch('https://api.myapp.com/api/safari-test') 200 OK Access-Control-Allow-Methods: GET,OPTIONS Access-Control-Allow-Origin: https://www.myapp.com Access-Control-Allow-Headers: Accept,Accept-Encoding,Accept-Language,Access-Control-Request-Header,Access-Control-Request-Method,Authorization,Cache-Control,Connection,Content-Type,DNT,Host,If-Modified-Since,Keep-Alive,Origin,Pragma,Referer,User-Agent,x-csrf-token,x-requested-with Content-Type: application/json; charset=UTF-8 Content-Encoding: gzip Date: Thu, 23 Sep 2021 16:32:00 GMT Vary: Accept-Encoding, Origin Server: nginx But if I pass headers, it doesn't work anymore: fetch('https://api.myapp.com/api/safari-test', { method: 'GET', headers: new Headers({ 'Authorization' : 'Bearer ...' }), mode: 'cors', cache: 'default' }) [err] Fetch API cannot load https://api.myapp.com/api/safari-test due to access control checks. I don't understand why, all the necessary headers are transmitted. Here is my nginx configuration: location ~ ^/api/safari-test { set $cors ''; if ($http_origin ~ ^(https?:\/\/www\.myapp\.com)$) { set $cors 'true'; } if ($request_method = 'OPTIONS') { set $cors "${cors}options"; } if ($request_method = 'GET') { set $cors "${cors}get"; } if ($cors = "true") { add_header 'Access-Control-Allow-Origin' "$http_origin" always; add_header 'Vary' Origin always; } if ($cors = "trueget") { add_header 'Access-Control-Allow-Origin' "$http_origin" always; add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'Accept,Accept-Encoding,Accept-Language,Access-Control-Request-Header,Access-Control-Request-Method,Authorization,Cache-Control,Connection,Content-Type,DNT,Host,If-Modified-Since,Keep-Alive,Origin,Pragma,Referer,User-Agent,x-csrf-token,x-requested-with' always; add_header 'Vary' Origin always; } if ($cors = "trueoptions") { add_header 'Connection' 'keep-alive' always; add_header 'Access-Control-Allow-Origin' "$http_origin" always; add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'Accept,Accept-Encoding,Accept-Language,Access-Control-Request-Header,Access-Control-Request-Method,Authorization,Cache-Control,Connection,Content-Type,DNT,Host,If-Modified-Since,Keep-Alive,Origin,Pragma,Referer,User-Agent,x-csrf-token,x-requested-with' always; add_header 'Access-Control-Max-Age' 3600 always; add_header 'Content-Type' 'text/plain charset=UTF-8' always; add_header 'Content-Length' 0 always; add_header 'Vary' Origin always; return 204; } fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_read_timeout 60s; fastcgi_pass unix:/run/php/php7.3-fpm.sock; fastcgi_index micro.php; fastcgi_param APP_ENV production; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/micro.php; fastcgi_param SCRIPT_NAME micro.php; } Thanks to anyone for an idea for a solution !!!
Posted
by ark4ne.
Last updated
.
Post not yet marked as solved
7 Replies
7.6k Views
On 10.12.6, selecting Allow Javascript from Apple Events from the Develop menu does not stick.Steps to reproduce-Develop menu > Allow Javascript from Apple EventsClick "Allow" in the dialog box.Result: Develop menu shows the setting UNchecked.Tested with defaults read shows it is enabled (1).Writing defaults completes without error.Tested in different user account.Tested with Safari beta 11.1.1, and Technology Preview
Posted
by Ballstone.
Last updated
.
Post not yet marked as solved
2 Replies
341 Views
Hi I'm new at developing, I want to learn how to call an api in xcode but deal with an error in the view controller.  the error tells 'cannot find xxxx in scope'. I know that I didn't define that xxxx anywhere but I don't know where should I put it. please help me by giving some example about calling an api in xcode or some information about how to call an api in xcode.
Posted
by zeynab.
Last updated
.
Post not yet marked as solved
1 Replies
201 Views
Hello guys. I used a Google Chrome and their dev tools and every time its worked perfect. Now I buy a new Mac and start using Safari Dev Tools... and i cannot use it anymore. Sometimes a want to just open link in page, that is in new tab, and I cannot, just see a blank start page with no content. Sometimes dev web inspector freezes and slow loading. Sometimes when I click some link, web redirects back and I need to click again.... Its very frustrating when develops web sites. Another bad think is, that when I have pages in groups and in one group I have something played (music, video, etc) when I click on another group, media stops playing. Why it is not work just like tabs in some category? So I need to return back to Chrome Tools, when everything's works on 150 percents. With regards Martin Jemelka
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.6k Views
I'm working on a native Cocoa app that has a few WKWebViews.When the app is running, I can open the Web Inspector by clickingDevelop > My Computer > Document.titleHowever when I re-run the app from Xcode, the Web Inspector disappears.I'd expect that the following toggle in Safari would do what it says, that is, open a new inspector as soon as my app runs again. However this doesn't work.Develop > My Computer > Automatically Show Web Inspector for JSContextsSeems like a bug. Is there anything I can do to automatically get a Web Inspector on each re-run?
Posted
by Mic.
Last updated
.
Post not yet marked as solved
0 Replies
178 Views
I have a Safari App Extension that uses an instance of WkWebView to run JavaScript code. This app extension runs flawlessly with Safari 13 & 14, but Safari 15 occasionally kills the WkWebView instance for no apparent reason. The only thing logged to the console is this message: (JavaScriptCore) Received an invalid message "<unknown message receiver>.<unknown message>" from the web process. SafariExtension: (WebKit) [com.apple.WebKit:Process] 0x10c2e9300 - WebProcessProxy didClose (web process crash) SafariExtension: (WebKit) [com.apple.WebKit:Process] 0x7ff1e7048020 - [pageProxyID=5, webPageID=6, PID=22131] WebPageProxy::processDidTerminate: (pid 22131), reason 3 I can't find any correlation between the JavaScript that's running and that error. The error seemingly occurs at random. Has anyone else experienced such a problem? Thanks
Posted
by dtheobald.
Last updated
.
Post not yet marked as solved
0 Replies
230 Views
Websites are not scrollable (not responding to touch swipe up/down gesture) in bottom area (around bottom 5% marked on screen). I have noticed on that area i am unable to scroll webpage only if i have moved address bar the top of browser (marked on screen2). Issue appears only when webpage is long and in due to scrolling all bars are going to be hidden. Tested on XS, 13 mini - same effect, ios 15.3 and earlier. https://feedbackassistant.apple.com/feedback/9837732 cant upload images, so you may find here https://imgur.com/xXHM97x https://imgur.com/CZhsOEs
Posted
by Kyokushin.
Last updated
.
Post not yet marked as solved
0 Replies
268 Views
Hey Apple-Community, Safari is currently asking to autofill a password for the current domain, is it possible to force Safari asking for an explicit other one? Example User visits https://exaple.com now Apple shows password for the website https://exaple.com but the user has the same password on this website like on https://other.net so Safari should be forced to list up https://other.net passwords on https://exaple.com login form. Thanks for helping me out. Jorit Vásconez Gerlach
Posted Last updated
.
Post not yet marked as solved
0 Replies
216 Views
I'm working on a Safari Web Extension that is migrated from Chrome/Firefox. Using the Web Inspector Storage tab has some strangeness. Note there is one key/value pair showing test = test. I execute await browser.storage.local.clear(). But the display does not change. I execute await browser.storage.local.get('test') and I get undefined, but the display still shows test = test. I execute await browser.storage.local.set({test: 'test 123'}) and I get undefined. No change to the display. I execute await browser.storage.local.get('test') and I get "test 123". Display still says test = test. All of this leaves me wondering "What is that display showing? Is it not the local storage associated with the extension? And if not, how can I view the extension's local storage area?"
Posted
by jackrg.
Last updated
.
Post marked as solved
1 Replies
403 Views
Hi! So im coding and I’m about to lauch the app via the simulator but I’t crashes and I get this error message. Thread 1: “-[UIViewController collectionView:numberOfItemsInSection:]: unrecognized selector sent to instance 0x130f0a530” And I've located the bug but I don’t understand it. The bug happens when I connect the collection view from the mainstory.board to the view controller. Specifically when I add the dataSource from the collection view to the view controller, how can I fix this, cause without this I just get a blanc screen on the sim? I'd happily share the project if that helps solving the issue!
Posted
by Gharfield.
Last updated
.
Post not yet marked as solved
1 Replies
249 Views
Hi there, I am a new apple user, I have a question I have and when I open it on safari, my website appears without responsiveness, can anyone guide me is there a safari issue or issue with my website. Website URL: https://cleanermachineinfo.com/
Posted Last updated
.
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 Last updated
.
Post not yet marked as solved
0 Replies
405 Views
I added CSP policy that works in all the browsers except in safari with multiple exceptions as shown in the [picture]( ) especially usersnap tool CSP policy I have used <add name="Content-Security-Policy" value="upgrade-insecure-requests; base-uri 'self'; frame-ancestors 'self'; form-action 'self'; object-src 'none'; default-src 'self' https: 'unsafe-eval';style-src https: 'unsafe-inline'; worker-src * 'self' blob: ;child-src 'self' blob://* blob:*; img-src * data: blob://* blob:*;script-src-elem 'self' https://static.ambita.com 'self' 'unsafe-eval' 'unsafe-inline' https://*.usersnap.com data: blob://* blob:*;frame-src * 'self' blob://* blob:*;"/> It would be great if you help us here
Posted Last updated
.
Post not yet marked as solved
3 Replies
1.9k Views
Hi All,I got a requirement to integrate Apple pay to our E-commerce website. This is intended only to run in safari mobile browsers. I am in search for a way to automate the apple pay integration. We will have an option from cart page to choose Apple pay. Once user selects this a panel is displayed which have options to select the saved credit card, addresses in the mobile phone (we call this as apple payment sheet). These informations are prefilled but user can change this. I believe this is some kind of native code which displays this panel above the safari. I need to device an end-to-end test which has both normal web simulation and the payment sheet simulation so that it could complete an order successfully.For this, I have few roadblocks:1. We need a common tool which can simulate user interaction in mobile web (this is currently done by webdriverIO) and the payment sheet provided by safari for apple pay(No idea how to inspect or simulate user interaction on this panel).2.We need to simulate fingerprint authorization from the test automation tool. I am still to get a solution for this. Have considered many tools but found out that none of them can help. Not sure about the capabilities of Appium in this regard. It would be of great help if someone can point me in the right direction of choice of tool that can be used here.Regards
Posted Last updated
.
Post not yet marked as solved
0 Replies
217 Views
Do you know any way that I can inspect elements in Apps NOT in Webapps by using the Safari Technology Preview DEV Tools ? Webapps is not what I am looking for, but native Apps. I have in my iPhone 12 mini iOs 15 and the Safari Release 134 (Safari 15.4, WebKit 16613.1.6.1)
Posted
by Aggie_sch.
Last updated
.
Post not yet marked as solved
1 Replies
266 Views
Hello, I am a new developer so sorry if the answer is obvious and I’m somehow missing it. The current script I have in index.html is this: document.getElementById('someID').addEventListener('click', async () => { chrome.tabs.query({ currentWindow: true, active: true }, (tabs) => { chrome.tabs.sendMessage(tabs[0].id, { key: 'value' }) }) And the code I have in script.js looks like: chrome.runtime.onMessage.addListener((message) => { message.key && script[message.key].run(message.args);}); This works perfectly fine in Chrome, but what commands would I use to do the same thing in Safari? Any assistance would be greatly appreciated, Thank you
Posted Last updated
.
Post not yet marked as solved
22 Replies
7.9k Views
Issue: The Safari web inspector debugging works before the MacOS and iOS upgrade. After upgraded MacOS to 11.3 and XCode to 12.5, and iOS (iPhone) to 14.5., it stops working. Reproducing Step: Launch iOS app (Javascript wrapped under Cordova), launch Safari from Mac, debug through web inspector, iOS app crashed immediately with memory issue: WebThread (9): EXC_BAD_ACCESS (code=2, address=0x16b6c2320) error at xcode - https://developer.apple.com/forums/content/attachment/39b21f9e-2d70-41ef-884f-06f02c0960de
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.2k Views
While making a video or audio call using WebRTC voice is coming too low, this issue is start happening after updating the IOS 15. Before updating the IOS version voice was used to coming through loudspeaker but now it don't
Posted
by ndsnaren.
Last updated
.