Questions tagged [browser-api]

26 questions
40
votes
2 answers

When should I use Web SQL versus IndexedDB?

Recently, I have come across the Web SQL and IndexedDB APIs that are provided by browsers. What are the use cases for Web SQL and IndexedDB and when should I use one over the other?
Utsav Sinha
  • 605
  • 1
  • 5
  • 12
6
votes
1 answer

How to mock Notifications API with JEST?

I test redux-actions with jest. Particular redux-action uses Notifications API as a side-effect. How can i mock Notifications API? Now, i simply mock it this way: global.Notification = {...}; It works, but i think there is more elegant solution to…
Constantine
  • 544
  • 5
  • 15
2
votes
2 answers

Is there a browser API that tells me preferences (font family, font size, size of focus, etc.) applied to the browser?

I'm wondering if there are APIs to know preferences users applied to browser, such as font-size, font-family, etc. I wrote this question because I've been asked to apply browser preferences to my HTML page. For example, if user has poor sight and…
Matt
  • 265
  • 4
  • 17
2
votes
2 answers

ScrollToOptions' behavior: 'smooth' broken in Chrome and Edge v81+

After testing in BrowserStack, I've concluded that using scrollTo() with option parameter behavior: smooth does not work in Chrome and Edge since version 81. Version 80 of both Edge and Chrome was working as expected. According to MDN, it should be…
2
votes
1 answer

Confirmation on browser back button

I'm trying to achieve the following with Gatsby The user is on a form page, if they hit the browser back button, a pop up would appear, asking if they want to leave. If the user selects ok, then it would go back. If the user selects cancel, then it…
Phantom
  • 423
  • 1
  • 5
  • 13
2
votes
0 answers

How to make page search on electron like in Chrome or VS Code or Firefox?

This is how the search looks like in chrome I tried to make something like this but I meet some problems. I use Window.getSelection() to highlight all matches, and separate input to get user query. But it does not highlight all added ranges like…
1
vote
0 answers

Why are there npm packages for Browser or Third Party API's?

I am getting to grips with vanilla JS and am trying to expand my horizons using some browser API's to make some more interesting applications. I am running Webpack, Babel and Jest on most of my packages. I am trying to establish the differences…
1
vote
1 answer

Angular SSR - using performance.now() in both browser and server

I want to set some performance marks and measures in my Angular components to measure how long selected components take to process and render. They work fine when running the app in "client mode", but as soon as I run the app in SSR mode, I get…
0
votes
0 answers

is there a way for web apps to access biometrics for biometrics login without the use of passkey

Is there a way to use phone biometrics such as faceID/fingerprint on android and Iphone on Blazor webassembly .net6 PWA to function it the same way it is in native apps without the use of passkey. I have tried the WebAuthn but it keep asking the…
0
votes
0 answers

Is there a way for Blazor webassembly .net6 to get wifi SSID

I am coding in blazor webassembly in .net6 and was trying out if I could get the user's wifi information such as ssid on any devices, However I could not find any information and I have tried to the network information API but no luck…
0
votes
1 answer

Why would Django Rest Framework token authentication work in Postman but not in browser

I have a Django REST framework API that uses TokenAuthentication. In Postman, I can authenticate with the API using a token and make requests successfully. However, when I try to use the browsable API in my web browser, I get an "Authentication…
0
votes
1 answer

Programmatically get the Range of a text spread over multiple elements

I have a code element, and I know the text I'm looking for is inside it, for example:

Lorem ipsum dolor sit amet

Note the span that is used for styling specific words. Now, assume I have a reference to the p…
baruchiro
  • 5,088
  • 5
  • 44
  • 66
0
votes
0 answers

Is there a way to determine whether Javascript code uses a specific Browser API?

I wonder if there is a way to determine whether the JavaScript code included on a specific website is using a specific Browser API, ideally through static analysis of the code. Specifically, I want to detect usage of the nagivator.credentials API. I…
Martin
  • 534
  • 4
  • 14
0
votes
2 answers

Why can the same methods as HTMLElement be applied to an instance of Element?

HTMLElement inherits properties/methods from the Element interface. But, why on an instance of Element, it works even when I use the same properties and methods which are defined on HTMLElement. For example, in the given code, querySelector gives…
0
votes
0 answers

Is there a way to get aspect ratio of the webcam in firefox

I'm trying to get the aspect ratio of the webcam using javascript. As per this documentation, it's not working for firefox. https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings/aspectRatio As Per it says, and I tried it's working in…
1
2