css27】base標籤帶有href屬性會讓chrome裡的svg元素url失效,css27chrome

來源:互聯網
上載者:User

css27】base標籤帶有href屬性會讓chrome裡的svg元素url失效,css27chrome

一個chrome的問題,但具體原因不明。

觸發條件:chrome瀏覽器base標籤裡href屬性有值的時候

觸發問題:svg裡面的元素如果有用url的濾鏡和模糊,則會失效,在firefox裡和IE10沒有發現這個問題。

正常狀態:

有base標籤且href裡值為“.”的時候chrome裡的狀態:

 測試代碼:

<!doctype html><html><head><meta charset="utf-8"><title>chrome bug</title><style>#svg{ width:500px; height:500px; display:block; margin:20px auto; background-color:#000; }</style><!--當href=""裡面有值的時候填寫的url都會失效--><base href="." target="_blank"><!--當href=""這樣則不會--><!--<base target="_blank">--></head><body><svg id="svg"><defs><lineargradient id="blur1" x1="0%" y1="0%" x2="100%" y2="0%">  <stop offset="0%" style="stop-color:#FF0000;stop-opacity:0"></stop>  <stop offset="100%" style="stop-color:#FF0000;stop-opacity:1"></stop></lineargradient><filter id="Gaussian_Blur"><feGaussianBlur in="SourceGraphic" stdDeviation="3" /></filter></defs><circle cx="200" cy="50" r="40" style="stroke:url(#blur1); filter:url(#Gaussian_Blur); stroke-width:10; fill:yellow; "/><line x1="0" y1="0" x2="300" y2="300" style="stroke:url(#blur1); stroke-width:2;" /></svg></body></html>

 

具體原因不明,希望有大神賜教。

 


在svg中用js建立新元素並添加成功,卻不可以顯示(SVG開發實踐)

首先1處改成node=svgdoc.createElementNS('www.w3.org/2000/svg', 'rect');是必須的,這樣才能建立一個svgRect元素。
其次,IE8不支援svg。IE9以上在運行這個檔案的時候會屏蔽動態內容,在頁面下方會有提示,點擊允許就行了。Firefox和chrome可以直接運行這個檔案。
 
SVG 顯示不出中文

年輕人。你用的函數是 File SVGOutputFile 吧。
我看你的SVG映像是動態產生的。我舉一個例子你試一下就明白了
先看你的做的例子

import java.lang.Math;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class generateontology {

public static void main(String[] args) {
List list=new ArrayList();
list.add("數學");
list.add("中文");
list.add("語文");
String path="F:\\";
renderSVGGradientOnToLogy("abc",list,path);

}
public static void renderSVGGradientOnToLogy(String username,List list, String path) {

//此處為中間圓心的寫入程式碼座標,尚可修改,
int CirCenterX=500;
int CirCenterY=400;
int r=50;//圓的半徑
int length=100;//射線的長度
int LineEndX=0;
int LineEndY=0;
int CirSecEndX=0;
int CirSecEndY=0;
String NewDirectPage="SVGSecInstance.jsp";

int ListAcount=list.size();

// This is where we find out what the largest value contained in each of the array is,
// its a simple loop that goes through each value passed, and determines the highest

try{
// Get the SVG file ready for the drawing of the perfomance graph
File SVGOutputFile = new File(path,"SVGOnToLogy.svg");
// File SVGOutputFile = new File("SVGOnToLogyTest1.svg");

FileWriter SVGout = new FileWrit......餘下全文>>
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.