473,398 Members | 2,188 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,398 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>
  4.  
  5. <p>This is an HTML paragraph</p>
  6.  
  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>
  11.  
  12. </body>
  13. </html> 
  14.  
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 7631
Dormilich
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
phpuser123
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
Dormilich
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
Dormilich
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
Dormilich
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
Dormilich
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

2
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...
1
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:...
3
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...
1
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. ...
8
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...
0
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...
2
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
1
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...
1
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
1
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....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.