Failed to load resource: the server responded with a status of 404 () - couldn't recognize css and js file, they are in same folder(GITHUB PAGES) - github

Getting page live on GitHub.
this was when it didn't work:
<link rel="stylesheet" href="/style.css">
<script defer src="/script.js"></script>
this is now, when it works:
<link rel="stylesheet" href="style.css">
<script defer src="script.js"></script>
What is the difference? Isn't that the same?

Not exactly. the / in the script.js tells where to find the file. / is telling it the "root" of the file system, while script.js is telling it relative to this file and "beside" it.

If your html/css/js files are in the same folder, that doesn't mean that / is pointing to that folder.
What you can do is find out where it points to and use that in your link and script tags. For example:
<link rel="stylesheet" href="/public/style.css">
<script defer src="/public/script.js"></script>
Passing relative addresses might become problematic in the future. Specially if you use routing in your application.

Related

Parcel outputs multiple CSS files

How do I configure parcel so that I get a single output CSS file? I am using version 2, and it seems that the default is to output a separate CSS file to dist for each stylesheet referenced in the HTML file. For instance, with this test.html file:
<html>
<head>
<link rel="stylesheet" href="./a.css">
<link rel="stylesheet" href="./b.css">
</head>
</html>
running parcel build test.html outputs two css files under "dist". Is there a way to make it output one combined file?
You can use the #import at-rule to combine multiple css files into a single bundle (see documentation).
For example, you could have an index.css with this content:
#import "a.css";
#import "b.css";
...and then reference index.css in your index.html file:
<html>
<head>
<link rel="stylesheet" href="./index.css">
</head>
</html>
See this example repo.
Edit:
Another way to achieve this goal, if your app uses javascript, is to do the css imports from a javascript file. So your html file would look like this:
<html>
<head>
<script src="./index.js" type="module"></script>
</head>
</html>
...and your index.js file would look like this:
import "./a.css";
import "./b.css";
// The rest of your app...

Configuring URL parameters in run configurations

My team is migrating to SAP BAS from SAP Web IDE. But when making run configurations I could not find how to configure something important to us: where to configure URL parameters like we could in the Web IDE.
I've consulted several pieces of SAP documentation such as this guide, but came away empty handed. The UI5 CLI also doesn't seem to offer anything interesting in this regard.
Does anyone know whether configuring URL parameters in run configurations is still possible, if necessary in the raw corresponding .env files?
Thank you in advance,
Joshua
I don`t know if you found yet how to do this but in any case, the solution that i found was to modify the Index.HTML file called and put a little piece of Script code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EXTRATOCLIENTE</title>
<script id="sap-ui-bootstrap" src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_belize" data-sap-ui-resourceroots='{"br.com.araguaia.EXTRATOCLIENTE": "./"}'
data-sap-ui-compatVersion="edge" data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
data-sap-ui-async="true" data-sap-ui-frameOptions="trusted">
</script>
<script>
var oStartupParameters = jQuery.sap.getUriParameters().mParams;
var oComponent = sap.ui.getCore().createComponent({
name: "br.com.araguaia.EXTRATOCLIENTE",
settings: {
componentData: { startupParameters: oStartupParameters }
}
});
new sap.ui.core.ComponentContainer({
component: oComponent
}).placeAt("content");
</script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>
After that you can put some parameter on the url like this :
index.html?Kunnr='123'&Kkber='ACRA'
Renan Pacheco
I also found a quick-and-dirty way to run with URL parameters. Run configurations are saved in the .vscode/launch.json file. In that file, there's an args array associated with each run configuration with a mention of the index.html file of your project. You can manually append your desired URL parameters to it.
There is a package.json which is created when you create any application.
It contains the script to start. You can add your URL parameters here.

Favicon link does download instead of show

I have a favicon on my page, and when i go to the link for the favicon: mypage/favicon.ico
It starts download, instead of just showing it as an online image (as every other site).
I've searched everywhere for a solution, but got no answer.
I want it to show, and not to be downloaded, what can be the problem?
<head>
<link rel="shortcut icon" href="/favicon.ico">
</head>
Its an .ico file at 32x32.
Thanks - Chris
You can show it in HTML as a regular image tag. This has been tested in Firefox 26, Chrome 29 and Internet Explorer 10. All with positive results. You can try on your own browsers if you'd like.
Code:
<!DOCTYPE html>
<html>
<body>
<img src = "logo.ico" type = "image/x-icon">
</body>
</html>
You should use
<head>
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
</head>
And consider to use another image e.g .png
<link rel="icon" href="/favicon.png" type="image/png" />
(Some Browsers does not support .ico)
If you call mypage/favicon.ico directly it might be dowloaded, depending on your http server/browser which mime type should be downloaded or displayed.
see Wikipedia.

jqGrid table off of DOM

I am trying to get jqGrid to work off a DOM table that already exists. I am a little confused with some of the instructions to do this however... For instance, I read this on one particular help site...
http://www.secondpersonplural.ca/jqgriddocs/_2h30t8wte.htm
When he says this:
"the new release of jquery.jqGrid.js defaults to this module being enabled, so ensure that grid.tbltogrid.js and grid.tbltogrid-min.js are copied to the appropriate folder. If you do not wish to include this function, make the appropriate change to jquery.jqGrid.js."
What is he talking about?
Also, the Jquery grid download site gave me this set of instructions:
"In order to use this module you should mark the Table to Grid (in Other modules) when you download the grid. For more information refer to Download.
For Developers - this is the grid.tbltogrid.js in the src directory."
Now I had the Table to Grid module marked when I downloaded.
What would I should be doing to get this done?
What function should I be calling, currently I am calling...
(function () {
tableToGrid(".table1", {});
});
That seems a little bit wrong.
UPDATE: Added what I reference
Here are the scripts that I reference... Ignore the DataTable scripts... I will soon be removing them once I can confirm that this works.
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="~/Content/jqUIcss/jquery-ui-1.8.14.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="~/Content/jqGrid/ui.jqgrid.css" />
<script type="text/javascript" src="<%=ResolveClientUrl("~/Scripts/jquery-1.5.1.min.js")%>"></script>
<link href="../../Content/dataTable.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=ResolveClientUrl("~/Scripts/jqUI/jquery-ui-1.8.14.custom.min.js")%>"></script>
<script src="<%=ResolveClientUrl("~/Scripts/lib/jquery.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/lib/jquery.metadata.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/jquery.validate.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/jquery.jqGrid.min.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/grid.locale-en.js")%>" type="text/javascript"></script>
Assuming you did download the components correctly and included them in your application through <script> tags, all you seem to have to do is:
tableToGrid('#table_name')
where the table name is the id of the table you're trying to convert.
Edit: Note the #, whereas you used . and what seems to be a table ID. . signifies a class name.
<script src="<%=ResolveClientUrl("~/Scripts/grid.base.js")%>" type="text/javascript"> </script>
<script src="<%=ResolveClientUrl("~/Scripts/grid.tbltogrid.js")%>" type="text/javascript"></script>
<script src="<%=ResolveClientUrl("~/Scripts/jqDnR.js")%>" type="text/javascript"></script>
Added these scripts and things seem to be fine.

Relative url automatic rewrite in asp.net MVC 2

ASP.net MVC 2 does rewrite all your relative urls in the <link> tag to the full relative path, which is good but it only works for URLs written in the <link> tag only, not <script> tags or any other elements.
Create an MVC 2 web application
create any controller and a view for it
inside the view create a <link> tag like this <link href="test.xml" type="text/css"/>
run your application, navigate to the view you created and then view source
you will find that MVC has rewritten your url in tag to full url like:
<link href="../Views/Home/Text.xml" type="text/css" />
i know that this file is in the Views folder and can't be viewed due to the web.config file that blocks any requests to files there, but thats not my problem
How can i get MVC to rewrite all urls not only in the <link> tage ?
Any help would be appreciated.
This happens because your <head> tag has a runat="server" attribute (a nasty heritage from WebForms). Remove it and no rewrites will happen. Also instead of:
<link href="test.css" type="text/css" />
you should always use Url helpers when dealing with urls:
<link href="<%= Url.Content("~/test.css") %>" type="text/css" />
You should not leave automatic rewrites to happen, always use Url.Content for linking static resources.
perhaps you have already tried something like this
<head runat="server">
<link href="test.xml" type="text/css"/>
<script src="<%= ((WebFormView)this.ViewContext.View).ViewPath.Substring(1,
((WebFormView)this.ViewContext.View).ViewPath.LastIndexOf('/')) %>test1.xml" type="text/javascript"></script>
</head>
renders html as
<head>
<link href="Views/Shared/test.xml" type="text/css" />
<script src="/Views/Home/test1.xml" type="text/javascript"></script>
</head>