mirror of https://github.com/abpframework/abp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
5 years ago
|
# CrossOriginStrategy
|
||
|
|
||
|
`CrossOriginStrategy` is a class exposed by @abp/ng.core package. Its instances define how a source referenced by an element will be retrieved by the browser and are consumed by other classes such as `LoadingStrategy`.
|
||
|
|
||
|
|
||
|
## API
|
||
|
|
||
|
|
||
|
### constructor(public crossorigin: 'anonymous' | 'use-credentials', public integrity?: string)
|
||
|
|
||
|
`crossorigin` is mapped to [the HTML attribute with the same name](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).
|
||
|
`integrity` is a hash for validating a remote resource. Its use is explained [here](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
|
||
|
|
||
|
|
||
|
### setCrossOrigin(element: HTMLElement): void
|
||
|
|
||
|
This method maps the aforementioned properties to the given `element`.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
## Predefined Cross-Origin Strategies
|
||
|
|
||
|
Predefined cross-origin strategies are accessible via `CROSS_ORIGIN_STRATEGY` constant.
|
||
|
|
||
|
|
||
|
### Anonymous(integrity?: string)
|
||
|
|
||
|
`crossorigin` will be set as `"anonymous"` and `integrity` is optional.
|
||
|
|
||
|
|
||
|
### UseCredentials(integrity?: string)
|
||
|
|
||
|
`crossorigin` will be set as `"use-credentials"` and `integrity` is optional.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
## What's Next?
|
||
|
|
||
|
- [LoadingStrategy](./Loading-Strategy.md)
|