0

I am using SF Canvas to embed an external Web Application in a VisualForce page in my org. The content is being successfully loaded in an IFrame in the browser. The page needs access to the USB feature (FeaturePolicy usb) which is set by the external server as header. Inside the IFrame, the feature is disabled. Is there a way to set it for the frame by setting an HTML Attribute like this:

<iframe allow="usb *">

Or maybe another way to solve the issue?

1

The purpose of iframe is to create a sandbox with restrictions.

https://www.w3schools.com/tags/att_iframe_sandbox.asp

When the sandbox attribute is present, and it will: (...) disable APIs

Try this approach: create a Lightning Component with API-Version 39 to disable Lightning Locker. I have tested this successfully with USB feature in Chrome browser.

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/security_code.htm

Disable Lightning Locker for an Aura component by setting the Salesforce API version to 39.0 or lower for the component. If a component is set to at least API version 40.0, Lightning Locker is enabled.

Inside the Lightning Component, you can use force:canvasApp.

https://developer.salesforce.com/docs/component-library/bundle/force:canvasApp/documentation

A force:canvasApp component represents a canvas app that's embedded in your Lightning component. You can create a web app in the language of your choice and expose it in Salesforce as a canvas app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.