optimization - Type of path best to use in web apps? -
There are two ways to call an image in your web application.
& lt; Img src = "/ myapp / img / world.gif" />
OR
& lt; Img src = "http://www.example.com/myapp/img/world.gif" />
Which would be best to use or both would be the same if both mean not equal, then why? And if I use the second method in my app to call all the files (images, SDF, FLV etc.), then there are any performance constraints
Generally speaking, the first method is a part of your application that should be your preferred way of referencing any resource. This is called Relative URI Reference and it allows you to transfer your application to any other domain-name without changing all the links.
You are the relative path such as
... assuming that the HTML appears at some place like
in this way you are not bound to the / myapp path prefix and can easily Your application can transfer / superpap without changing anything.
Most application frameworks and templateing systems are a way to report the root urr of the current application. In such cases, it
& lt; Img src = "$ (APPROOT) /img/world.gif" /> can be most convenient to use, such as
... specific replacement / extension of your replacement Depends on the mechanism which is your special repatriation. Here it is believed that $ (APPROOT) will be replaced with the full URI of the current application.
Comments
Post a Comment