473,372 Members | 1,089 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

Why is my svg file not displaying in my browser?

108 100+
I just implemented a small svg script...
Expand|Select|Wrap|Line Numbers
  1. <html
  2. xmlns:svg="http://www.w3.org/2000/svg">
  3. <body>
  5. <p>This is an HTML paragraph</p>
  7. <svg:svg width="300" height="100" version="1.1" >
  8. <svg:circle cx="100" cy="50" r="40" stroke="black"
  9. stroke-width="2" fill="red" />
  10. </svg:svg>
  12. </body>
  13. </html> 
When I preview this script in my browser,I am not able to view the svg ....I am using Mozilla firefox 3.2...
ang my file name is test.html...
Why i am not able to see the circle???Where have i erred??
Jun 1 '10 #1
10 7626
8,658 Expert Mod 8TB
I believe, the problem is that you try it with HTML. you would need to use XHTML.
Jun 1 '10 #2
108 100+
Thanks ,it did work..
Jun 1 '10 #3
I have the same problem.
I use Drupal and all my pages don't have the .xhtml extension.
May be there is a way to create some declaration inside .html document to make firefox display svg without .html extension?
I can't find any solutions yet.
Thank you.
Jul 14 '10 #4
8,658 Expert Mod 8TB
is it a link to an svg file or inline svg?
Jul 15 '10 #5
It is inline svg.
Yesterday i got some solution. I found svgweb library written in javascript. It works, i implemented it into my drupal site, but i'm still interested, may be there is a solution, that is easier. Thank you.
Jul 15 '10 #6
8,658 Expert Mod 8TB
the easiest solution is (as has been previously stated) using XHTML (with at least the text/xml or better application/xhtml+xml header (i.e. use the xhtml extension))

HTML is not able to display such XML, that’s why XHTML was invented.
Jul 15 '10 #7
And what if i am not able to use xhtml extensions?
It's drupal with .php files.
What to do in this case? Use mod_rewrite rules or...?
I was looking for a possibility of using .html or .php files with some declaration in DOCTYPE or <html xmlns...>, but the today's solution is still the using of svgweb.
Jul 15 '10 #8
8,658 Expert Mod 8TB
if you’re using PHP, use the header() function to send the MIME type.

again, you cannot use inline SVG in native HTML files.
Jul 15 '10 #9
I have <svg>...</svg> block that i want to be displayed.
Could you please show any _simple_ example of using header() function? Where it should be used?
I am a complete newbie in Drupal, PHP, svg...
Jul 15 '10 #10
8,658 Expert Mod 8TB
where: before you start any (HTML) output (i.e. top of the page)

_simple_ example: header("Content-Type: application/xhtml+xml");
Jul 15 '10 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Lin Ma | last post by:
I have a asp web page with a link point to a file which depend on the database information. Sometime is a picture file sometime a word and some time is a PDF file. For picture file, when user...
by: Mei Qin | last post by:
Hello, I created a csv file on the server. I want to display it in the browser and user can download the file to local machine. Then I will delete the file from the server. Here is my code:...
by: Daniel | last post by:
Hi, I have opened the word file from database and display in web browser. When i close the browser, i wan to update the changes into the database. and i dont know how to achieve it. I oni know...
by: asad | last post by:
hello how ru all, i have some problem in displaying xml file in asp.net, i successfully create an xml file but when want to display it through ASP.NET code it throwing following error. ...
by: VinayKumarParakoti | last post by:
Hi all, I am new to this site and this is my first post. But this issue is of high priority. I am trying to print pdf file in browser using perl script. Onclick on hyperlink a child window...
by: =?Utf-8?B?c2NvdHRybQ==?= | last post by:
I have a button on a web page that retrieves some binary data (a word document) from a database as a stream and writes it to a web page. This is working ok, only problem is when someone clicks...
by: sbettadpur | last post by:
hello everybody, i want to open word document file in browser, it means there will be one hyperlink if i click(ex: it's file.doc) on that it has to open the file in the browser. thanks
by: ateale | last post by:
Hi Guys, I am using ruby on rails trying to develop a basic cms/dam for our company. The work we do is post production for television commercials. Each tv commercial we do broken down into...
by: 9916404403 | last post by:
How to display PDF file in browser without having any save option using Asp.net my mail id is email removed for security
by: madhuriks | last post by:
hi, i developed xml file..i want to view that xml file in browser...but im unable to do..it is showing in console..but i need is in browser..can any one help me out..here is my code..its urgent....
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.