如何解决基本标签的问题?

[英]How to solve a problem with base tag?


I have a problem with base tag. It looks like
<base href="http://myexamplepage.com/myfolder/" />.

我有基本标签的问题。它看起来像

Everything works, besides this query:
$.get("application/soft/calendar_month_change.php", ...)

除了这个查询之外,一切正常:$ .get(“application / soft / calendar_month_change.php”,...)

My computer thinks it's cross domain server and changes query to OPTIONS .... When I remove the base tag, it works correctly but my site doesn't show any images. I use smarty template engine. How can I solve it?

我的计算机认为它是跨域服务器并将查询更改为OPTIONS ....当我删除基本标记时,它可以正常工作,但我的网站不显示任何图像。我使用smarty模板引擎。我该如何解决?

1 个解决方案

#1


2  

How can I solve it?

我该如何解决?

Want my opinion? Don't use base. Exactly for the reason presented here: It creates confusion, and influences other parts of the system in a way that is extremely difficult to debug. (Although I didn't know it even influences relative AJAX calls.)

想要我的意见?不要使用碱。正是由于这里提出的原因:它产生了混乱,并以极难调试的方式影响系统的其他部分。 (虽然我不知道它甚至会影响相对的AJAX调用。)

I would define a web root in Smarty, and prepend that for every image URL in the document. Changing the web root remains easy, but the browser is given absolute URLs.

我将在Smarty中定义一个Web根目录,并为文档中的每个图像URL添加前一个。更改Web根目录仍然很容易,但浏览器会获得绝对URL。

You could, however, also solve this by providing an absolute URL in the Ajax request and leave the base in place.

但是,您也可以通过在Ajax请求中提供绝对URL并将基础留在原位来解决此问题。

$.get("http://domain.com/application/soft/calendar_month_change.php", ...)

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2010/07/09/fb4a6d818f1cca54da3e24df6f446aca.html



 
  © 2014-2022 ITdaan.com 联系我们: