Skip to content

Instantly share code, notes, and snippets.

@minhth1905
Created October 9, 2019 04:53
isFlashEnabled()
{
var hasFlash = false;
try
{
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if(fo) hasFlash = true;
}
catch(e)
{
if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) hasFlash = true;
}
console.log(hasFlash);
return hasFlash;
}
@minhth1905
Copy link
Author

get pop in string

getPropFromJSON(prop, JSONString){
    // Obviously this regex will only match Keys that have
    // String Values.
    var exp = new RegExp("\""+prop+"\"\:[^\,\}]*");
    return JSONString.match(exp)[0].replace("\""+prop+"\":","");
  }

show image
typescript
let name = this.getPropFromJSON("packetbase64", test); name = name.replace('"', '').replace('"', ''); console.log(name); this.testBase64 = 'data:image/jpg;base64,' + (this.sanitizer.bypassSecurityTrustResourceUrl(name) as any).changingThisBreaksApplicationSecurity;
Image
<img [src]="testBase64" alt="">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment