0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MIAW を外部Webサイトへ埋め込み方法について

Last updated at Posted at 2024-10-18

外部サイトのURLをCORSに登録

image.png

MIAWサイトエンドポイントを確認

image.png

image.png

コードをコピー

image.png

image.png

Trusted Domains for Inline Framesに外部サイトのドメインを追加

image.png

注意:サイトエンドポイント: ESW_MiwaService_17277500521321
より1桁少ない
ESW_MiwaService_1727750052132となっているサイト

image.png

Trusted Domains for Inline Framesに外部サイトのURLを追加

image.png

外部サイトが "https://gaibusite.com" の場合は、以下のように

image.png

追加しないと以下のエラーが発生

Refused to frame 'https://xxxxx-dev-ed.develop.my.site.com/' because 
an ancestor violates the following Content Security Policy directive: 
"frame-ancestors xxxxx-dev-ed--c.develop.f.force.com 
xxxxx-dev-ed.develop.my.site.com *.xxxxx-dev-ed.develop.my.site.com".

image.png

注意:LocalにHTML形式のファイルを作るだけでは、動かない。
サーバーがある所に作らないと行けない。

sample code

xxxxx部分はマスキングしたもの

<html>
 <head>

<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
 <title>はじめてのMIAW</title>
 </head>
 <body>
   <h1>Hello MIAW</h1>
   <p>エンジニアをxxxxx </p>
<script type='text/javascript'>
	function initEmbeddedMessaging() {
		try {
			embeddedservice_bootstrap.settings.language = 'ja'; // For example, enter 'en' or 'en-US'

			embeddedservice_bootstrap.init(
				'00DIT000003nFQ5',
				'MiwaService',
				'https://xxxxx-dev-ed.develop.my.site.com/ESWMiwaService1727750052132',
				{
					scrt2URL: 'https://xxxxx-dev-ed.develop.my.salesforce-scrt.com'
				}
			);
		} catch (err) {
			console.error('Error loading Embedded Messaging: ', err);
		}
	};
</script>
<script type='text/javascript' src='https://xxxxx-dev-ed.develop.my.site.com/ESWMiwaService1727750052132/assets/js/bootstrap.min.js' onload='initEmbeddedMessaging()'></script>

</body>
</html>

テスト結果

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?