Narasimhan
Narasimhan

Reputation: 83

SafeValue must use [property] getting appended to url in iframe src (Angular 14)

I am binding a link in iframe src as below

public resultLink: SafeResourceUrl;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             

this.resultLink = this.domSanitizer.bypassSecurityTrustResourceUrl(searchResult.pageUrl);

<iframe title="Finder Results" [src]="resultLink"></iframe>

But I am getting following output

<iframe title="Finder Results"  src="SafeValue must use [property]=binding: www.testurl.com (See https://g.co/ng/security#xss)"></iframe>

How can we fix this?

Upvotes: 0

Views: 216

Answers (1)

Wandrille
Wandrille

Reputation: 6801

It could related to safeUrl:

<iframe title="Finder Results" [src]="resultLink | safeUrl"></iframe>

Upvotes: 0

Related Questions