如何解決基本標簽的問題?

[英]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 联系我们: