Carbon-Forum icon indicating copy to clipboard operation
Carbon-Forum copied to clipboard

embed iframe object HTML tag NOT working? 编辑器嵌入iframe object

Open hoogw opened this issue 6 years ago • 2 comments

I try to embed a iframe in editor. but it would not save to database.

If I close it, then re-open the post, the html iframe is missing.

Do you know why? How to fix it?

I try to embed <object type="text/html" data="http://j2t.transparentgov.net/folder.html?url=https://geodata.epa.gov/arcgis/rest/services"width="600"height="600"></object>

<object type="text/html" data="http://j2t.transparentgov.net/folder.html?url=https://geodata.epa.gov/arcgis/rest/services" width="600" height="600"

hoogw avatar Oct 23 '18 21:10 hoogw

I found solution. 2 steps.

  1. 添加你的iframe src 域名到白名单过滤器 C:\Apache24\htdocs\glassgov1\common.php

open common.php, search "iframe", add your iframe src domain to white filter.

I add **'j2t.transparentgov.net', 'transparentgov.net', 'www.transparentgov.net',
            'ms1.transparentgov.net',**   

 to  **$hostWhiteList**

//跨站脚本白名单过滤 function XssEscape($html) { $filter = new WhiteHTMLFilter(); $urlFilter = function($url) { $token = parse_url($url); if (empty($token['scheme']) || in_array($token['scheme'], array('http', 'https')) === false) { return ''; } $hostWhiteList = array( 'j2t.transparentgov.net', 'transparentgov.net', 'www.transparentgov.net', 'ms1.transparentgov.net', 'www.youtube.com', 'youtube.com', 'www.youtu.be', 'youtu.be', 'player.youku.com', 'v.youku.com',

2)ueditor config 添加 iframe 元素,object 元素。 C:\Apache24\htdocs\glassgov1\static\editor\ueditor.config.js

Open ueditor.config.js, add below 3 line code at : window.UEDITOR_CONFIG = { )

            // allow embed iframe tag
            ,iframe: ['frameborder','src','width','height']
            ,object: ['type','data','width','height']

// allow embed iframe tag ,iframe: ['frameborder','src','width','height'] ,object: ['type','data','width','height']

Success embed iframe, object html tag

hoogw avatar Oct 23 '18 22:10 hoogw

@hoogw nginx呢?怎么操作

asleep2 avatar Dec 19 '18 07:12 asleep2