Framework7 <a href=""> not working

时间:2016-08-24 07:19:07

标签: javascript ajax html-framework-7

I have a simple <a> in a page which is using FrameWork7 as follows:

<li><a href="https://www.google.com/"><img src="images/icons/black/users.png" alt="" title="" /><span>Go Google/span></a></li>

But when I click on that it is not redirecting to google page. I have checked console and it shows as follows:

XMLHttpRequest cannot load https://www.google.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
framework7.js:12307 XHR failed loading: GET "https://www.google.com/".$.ajax @ framework7.js:12307app.get @ framework7.js:1652app.router.load @ framework7.js:2648load @ framework7.js:636handleClicks @ framework7.js:7573handleLiveEvent @ framework7.js:11488

I am new to Framework7. I have purchased a template for development.

2 个答案:

答案 0 :(得分:6)

正如docs所说:

  

可以绕过F7链接处理程序(如果要添加自定义   链接的逻辑,或希望它直接到外部网站)。在这种情况下   我们需要额外的external

<a class="link external" href="http://google.com">Open Google</a>

您希望链接到Framework7应用程序之外,因此只需将external类添加到a href并使其正常工作

<li><a href="https://www.google.com/" class="external"><img src="images/icons/black/users.png" alt="" title="" /><span>Go Google</span></a></li>

并且看到你写了关闭结束标记

的拼写错误

答案 1 :(得分:0)

你没有关闭跨度,也添加了一个目标:

<li><a href="https://www.google.com/" target="_blank"><img src="images/icons/black/users.png" alt="" title="" /><span>Go Google</span></a></li>