Uncaught SyntaxError:意外的标识符 - 在新窗口中打开Twitter共享

时间:2015-02-03 20:55:32

标签: javascript html twitter anchor new-window

我正在尝试为我的网站创建分享链接,该链接在Facebook,Google Plus和Twitter的新窗口中打开。 Facebook和g +链接工作正常,但是Twitter正在给我一个Uncaught SyntaxError: Unexpected identifier错误并且没有打开任何内容。它可能与预填充状态有关吗? URL本身工作正常。只是在新窗口中添加了导致错误的开口。

Twitter的:

   <a href='#' onclick="window.open('https://twitter.com/home?status=Message','width=1100,height=500');">
   <img src="/wp-content/uploads/2015/01/header_07.png"/>
   </a>

Google Plus:

  <a href='#' onclick="window.open('https://plus.google.com/share?url=http://staging.example.org','mywindow','width=1100,height=500');">
  <img src="/wp-content/uploads/2015/01/header_05.png"/>
  </a>

1 个答案:

答案 0 :(得分:0)

我仍然对之前遇到的问题感到困惑,但我为我的Twitter分享尝试了不同的方法并获得了以下代码:

<a href="https://twitter.com/home?status=MESSAGE"
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=260,width=600');return false;">