473,608 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why is my svg file not displaying in my browser?

108 New Member
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 7666
Dormilich
8,658 Recognized Expert Moderator Expert
I believe, the problem is that you try it with HTML. you would need to use XHTML.
Jun 1 '10 #2
phpuser123
108 New Member
Thanks ,it did work..
Jun 1 '10 #3
Stanislaw
4 New Member
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 Recognized Expert Moderator Expert
is it a link to an svg file or inline svg?
Jul 15 '10 #5
Stanislaw
4 New Member
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 Recognized Expert Moderator Expert
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
Stanislaw
4 New Member
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 Recognized Expert Moderator Expert
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
Stanislaw
4 New Member
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

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

Similar topics

2
4387
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 click the link, it will open the picture inside the IE browser. Now here is my problem: On some of the computers, for PDF file only, it opens outside of the IE
1
3521
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: Fname = "myfile.csv" Response.ClearContent() Response.ClearHeaders() Response.ContentType = "application/vnd.ms-excel"
3
2174
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 when i upload the file, i need to use filefield control, but now the situation is different. I cant automatically read the file location and filename as the filefield input. how to achieve it? any ideas?
1
1329
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. Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it. Line 2, position 3.
8
15677
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 is opened along with through javascript i have redirected to perl.In perl i am doing something like this, print "Expires -1\n\n"; print "Content-Disposition: Attachmet; filename="Path of the file";
0
1180
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 "open" on the File Download dialog that pops up it displays the word doucument in the browser, if you click back from there it goes to the previous page not the page where the button to open the document was clicked. I want it to go back to the same...
2
5277
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
2910
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 'shots' (or edit), and each shot usually goes through multiple versions/iterations. And lastly each of these shots incorporates elements from 2d and 3d artists - each having multiple versions. What I want to do is find a way for artists/clients to be...
1
6198
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
1566
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. package xml; import java.io.*; import org.w3c.dom.*;
0
8063
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8003
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8498
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8478
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8152
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6817
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5476
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4025
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.