Skip to content

Commit

Permalink
Add list of unsupported browsers to pxttarget json (#5687)
Browse files Browse the repository at this point in the history
* Add browser blacklist to pxttarget json

* Null check for blacklist

* Rename to unsupportedBrowsers

* Move to AppTarget

* Reformat to be object

* Remove reference from comment
  • Loading branch information
shakao authored and pelikhan committed Jun 19, 2019
1 parent 98da547 commit 7030618
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions localtypings/pxtarget.d.ts
Expand Up @@ -49,6 +49,11 @@ declare namespace pxt {
ignoreDocsErrors?: boolean;
variants?: Map<AppTarget>; // patches on top of the current AppTarget for different chip variants
queryVariants?: Map<AppTarget>; // patches on top of the current AppTarget using query url regex
unsupportedBrowsers?: BrowserOptions[] // list of unsupported browsers for a specific target (eg IE11 in arcade). check browserutils.js browser() function for strings
}

interface BrowserOptions {
id: string;
}

interface ProjectTemplate {
Expand Down
5 changes: 5 additions & 0 deletions pxtlib/browserutils.ts
Expand Up @@ -218,6 +218,11 @@ namespace pxt.BrowserUtils {
if (/bot|crawler|spider|crawling/i.test(navigator.userAgent))
return true;

//Check target theme to see if this browser is supported
if (pxt.appTarget.unsupportedBrowsers && pxt.appTarget.unsupportedBrowsers.some(b => b.id == browser())) {
return false
}

// testing browser versions
const versionString = browserVersion();
const v = parseInt(versionString || "0")
Expand Down

0 comments on commit 7030618

Please sign in to comment.