小编Moh*_*san的帖子

youtube 嵌入视频错误 NO ACCESS-CONTROL-ALLOW-ORIGIN

正如您在此处看到的https://mohamed-hassan.com/samples/project24/,如果您打开控制台,您将看到此错误

(ZYLR4KocS2Q?enablejsapi=1&autoplay=1&mute=1&controls=0&showinfo=0&modestbranding=1&rel=0:1 Failed to load https://googleads.g.doubleclick.net/pagead/id: Redirect from 'https://googleads.g.doubleclick.net/pagead/id' to 'data:text;charset=utf-8,' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.youtube.com' is therefore not allowed access.)

I just embedded video from youtube using iframe tag and I added at the top of the index file header('Access-Control-Allow-Origin: *'); but still get this error.

Here is a screenshot 在此输入图像描述

youtube-api

5
推荐指数
1
解决办法
2万
查看次数

替换所有字符串jquery中的制表符

我有字符串,我需要用“|”替换制表符(空格)。该功能工作正常,但问题是有多个制表符在一起,所以它显示如下( this||is|||text|| || ),我需要的是( this|is|text )这里是示例。

$(document).ready(function() {
  var text = $(".para").text();
  $(".result").text(text.replace(/\t/g, "|"));
  
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>

<div class="container">
  <p class="para">
        Aa aa		Aaa aa
  Bb bb	Bb bb		Bbb bb	bb
    cc	cccc	C ccccc	
      dd		Dd d
  Ee e				
      fff		fff
  </p>
  
  <p class="result"></p>
</div
Run Code Online (Sandbox Code Playgroud)

javascript regex jquery

2
推荐指数
1
解决办法
1417
查看次数

标签 统计

javascript ×1

jquery ×1

regex ×1

youtube-api ×1