Code Monkey home page Code Monkey logo

mapbox-gl-supported's Introduction

Mapbox GL JS Supported

This library determines if a browser supports Mapbox GL JS.

Testing Your Browser

You may test your browser here.

Using Mapbox GL JS Supported with a <script> tag

<script src='mapbox-gl-supported.js'></script>
<script>
if (mapboxgl.supported()) {
    ...
} else {
    ...
}
</script>

Using Mapbox GL JS Supported with Browserify

npm install --save @mapbox/mapbox-gl-supported
var mapboxglSupported = require('@mapbox/mapbox-gl-supported');

if (mapboxglSupported.supported()) {
    ...
}

mapbox-gl-supported's People

Contributors

alexceder avatar danswick avatar dependabot[bot] avatar harelm avatar harto avatar jfirebaugh avatar kkaefer avatar ljbade avatar mourner avatar msbarry avatar stepankuzmin avatar thibaudlopez avatar tmcw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mapbox-gl-supported's Issues

Is there a benefit to using this over .supported() in mapbox/mapbox-gl?

Hi everybody, today we started using the supported() method of mapbox-gl to check support before showing mapbox on an older version of Firefox that was throwing exceptions. After checking for support, the older version of Firefox is working great and skipping the map. But we still see some warnings.

Are those warnings that are logged in the process of checking support? Does this library do that differently?

Add Chrome on OS X 10.6.8

Chrome has been unsupported on OS X 10.6.8 for quite a while. The latest version seems to be 49.0.2623.

I'm getting reports that the compileShader part doesn't work on all those machines. It terminates with

AssertionError
null == true

For this line:
https://github.com/mapbox/mapbox-gl-js/blob/7c951985e4d967abc048ce5568c4edd6add05c8b/src/render/program.js#L44

Do you have any idea how to detect compilation errors? Or just blacklist OS X 10.6 + Chrome?
I don't have access to any such machine here.

test failing on default Android browser 4.4.2

Hello,

I tested the "mapbox-gl-supported" on Android version 4.4.2 but the test does not fail though the map is not displayed properly:
screenshot_2017-02-10-20-13-28

The console is saying:
"WebGL : INVALID_OPERATION: drawArrays:attribs not setup correctly.
"WebGL : INVALID_OPERATION: no ELEMENT_ARRAY_BUFFER bound

I can add that on the same phone, under Chrome, the same map is displayed properly.

Should another test be added ?

Thanks

Mapbox-gl broken on new Chrome

I'm running Google Chrome version 87.0.4270.0 (Official Build) dev (64-bit), which is currently the stock build on Fedora. Apps running Mapbox-gl now no longer work. Your detector states:

MAPBOX GL JS IS NOT SUPPORTED (INSUFFICIENT WEBGL SUPPORT)

This needs to be fixed before this Chrome release becomes mainline.

  • kv, Karen

Export webGLContextAttributes directly

Now that we use named exports in v2, we should export webGLContextAttributes directly instead of making in a property of the supported function. I overlooked this but should be a quick change โ€” only used internally in GL JS v2 and not documented, so might not need a semver-major.

ArrayBuffer.isView not checked

Some older browsers, like (Chrome Mobile 36) doesn't support ArrayBuffer.isView, yet it's required.

The error being raised is:

Object function ArrayBuffer() { [native code] } has no method 'isView'

isWebGLSupported is breaking apps on Mobile Safari 9

I'm using mapboxgl.supported() in an app to display a warning if map cannot work.
The problem is that since 1.5.0 it is using gl.createShader(gl.VERTEX_SHADER) code, which is throwing exception in Mobile Safari 9 on iPads and a bunch of other older browsers.

The exception is

r.createShader is not a function. (In 'r.createShader(r.VERTEX_SHADER)', 'r.createShader' is undefined)

This wouldn't be a big problem, but this library is supposed to detect especially these unsupported browsers without breaking the main app and unfortunately with recent release this happens.

The solution is maybe as simple as testing for gl.createShader first. I cannot test it, as I have no Mobile Safari / old iPads, I only see it in Sentry errors.

export check results

I've migrated a website to Mapbox GL JS and I'd like to show some friendlier warning to users with unsupported browsers. Such as "WebGL is not enabled" or "Please update your browser".

Right now it requires me to copy-paste the code from index.js into my own project.

I'd be nice to have .isWebGLSupportedCached exported as module's variables.

npm package name

The NPM package name for this repo is still mapbox-gl-js-supported - will you be publishing this under the new name from now on?

Support inaccurate for strict content security policy environment

Hello,

My team and I are working on an app that uses react-map-gl and mapLibre-gl-js. Our live site is required to run in a strict content security policy environment, so I've been following the steps in the maplibre documentation for setting the workerUrl. No issues in firefox, but chrome gives the same "refused to create worker from blob" every time.

I finally determined that this is caused by react-map-gl's call to the supported function, which creates a worker from a blob URL, which causes an error and indicates that the browser is not supported. This seems inaccurate because there is a fix for the content security policy issues, which would mean the browser is supported. It would be very useful to have a similar fix for the supported function.

Let me know if this is the wrong place for this issue, and thank you for your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.