I’ve a url which I’m sanitising using sanitizer and then binding the url variable dynamically on my iframe.
Below is my code:
.ts file
this.filePath = 'https://ionicframework.com/docs/';
if(this.filePath.endsWith('.pdf'))
this.viewSelector=true;
else
this.viewSelector=false;
this.trustedUrl = sanitizer.bypassSecurityTrustResourceUrl(this.filePath);
.html file:
<iframe id="articleFullView" [src]='trustedUrl' [hidden]="viewSelector"></iframe>
When I hardcord the url on the iframe directly then it works fine but with dynamic binding it shows the below error:
The url that I’m passing is of ionic official web app. It shows the same error for all the urls.