DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing values to be safe to use in the different DOM contexts. Any questions concerning DomSanitizer package
Questions tagged [angular-dom-sanitizer]
120 questions
0
votes
0 answers
Why is document.getElementByID returning null?
Goal: Send variable from Angular application to iFrame on that page but living on another server
Question: Why is document.getElementById returning null? Am I using DomSanitizer incorrectly or postMessage incorrectly?
(What I've tried)
I placed it…

angleUr
- 449
- 1
- 8
- 27
0
votes
1 answer
How to create a global whitelist of trusted URLs?
I want to implement a global whitelist functionality for safe URLs in bypassing resource URLs in Angular 2 similar to that provided by AngularJS through its $sceDelegateProvider as outlined here
I have tried referring to the Angular docs but I can't…

theJediCode
- 112
- 2
- 12
0
votes
2 answers
What can be used instead of $sce in angular 7?
We were using $sce in angular 1 to show html tags like this
>
xyzz yttryrtyt style="color:#e74c3c">abc.
in user readable form. What is substitute for same in Angular 7. Can anybody answer this and how to use…
Shilpi Jaiswal
- 1,178
- 2
- 12
- 27
0
votes
0 answers
angular innerHTML doesn't show the json text like '
Need some help with angular innerHTML and writing json data from server to HTML.
I have json with string like:
' %ext;]>
'
I'm trying to…

Den Kerny
- 562
- 10
- 18
0
votes
0 answers
Use custom pipe in multiple modules without sharedModule
Is it possible to use CustomPipe in lazy modules without using common or shared modules. I don't want to write pipe for every module.
Below is my CustomPipe.ts
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from…

Ashish Gehlot
- 483
- 8
- 16
0
votes
3 answers
how to apply style to Pseudo Elements before and after in template using sanitizer.bypassSecurityTrustStyle
I am trying to apply style to pseudo element :after
{{item?.eco}}
I need to change the background color of a:after and that I need to handle in html
something like [style.background]="red" to a:after in Html not in…

sneha mahalank
- 167
- 2
- 4
- 15
0
votes
0 answers
ionic 3 URL images showing up in iOS but not android
I'm trying to load images from http://admin:1234@192.168.8.112/ on my local network
Here are iOS and android screenshots from the emulators respectively
For some reason the images only show up on iOS and not on android.
Here is the relevant…

Riazbapoo
- 61
- 5
0
votes
1 answer
DomSanitizer DI failed in jasmine
I am trying to test a simple component with jasmine that have the constructor below
constructor(public sanitizer: DomSanitizer) { }
In my test, i have a testBed like
describe("Component: myComponent", () => {
let component: myComponent;
let…

Nuru Salihu
- 4,756
- 17
- 65
- 116
0
votes
1 answer
iframe [src]="videoUrl | sanitize" - when page reloading causes 404 iframe of my website
I'm trying to load a videoUrl from a database and assigning it to the iframe [attr.src] to show a youtube video. The data has to come from a database, there's no other way around that for me besides uploading the video and displaying that, which we…

Alex Liosatos
- 321
- 1
- 4
- 15
0
votes
1 answer
Injecting a HTML input element into a span is not working in Angular 2
Hi I have form questions that require the user to replace text in a sentence. For example... 'Today is ' where the user will fill in the current day but I am not able to inject inputs through 'innerHtml' alone. I have placed my current code…

Shane Watson
- 133
- 1
- 12
0
votes
0 answers
Angular2: Use DomSanitizer with HTML and STYLE
I use angular 2.1.2, and I want to use sanitize method to prevent XSS/CSRF attacks.
I implemented:
this.sanitizer.sanitize(SecurityContext.HTML, this.content)
The html file have html, style, javascript. So this method will unwrap the style and…

ThuyNguyen
- 1,127
- 3
- 14
- 24
0
votes
1 answer
Ionic 3 Error bind m3u8 from API
I'm trying to bind a url in video from API, but I'm taking this error below, I tried DomSanitizer and others but dosent work.
Error
Failed to load resource: net::ERR_FILE_NOT_FOUND
My last try
load() {
this.liveProvider.load().then((data)…

thiago.adriano26
- 1,491
- 3
- 14
- 19
0
votes
1 answer
Angular2 stops (click) working when using DomSanitizer
I'm using Angular2 with typescript.
I have a pipe that works regarding rendering the HTML fine.
Problem is the DomSanitizer seems to stop the (click) event from working.
When I check the HTML in the console.log (F12) the (click) code seems to be…

AngularM
- 15,982
- 28
- 94
- 169
-1
votes
1 answer
Error:Property 'bypassSecurityTrustUrl' does not exist on type 'typeof CommonFunctions', when using it in a function?
I want to build a common class for the frequently used statements in function.
and i am getting error if i use this keyword within a function.
import {Component} from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
…

VJain
- 1,027
- 7
- 17
- 37
-1
votes
1 answer
Unable to display imdb.com in iframe in angular2 even after using domSanitizer and SafeResourceUrl
Unable to display www.imdb.com in iframe in angular2 even after using domSanitizer and SafeResourceUrl. But can display Yelp using those.
The error I get is "Refused to display http://www.imdb.com/showtimes/location/US/12345' in a frame because an…