HTML Link not working? - html

I'm running this jade-based app locally and I've been trying to include a ejs file in it but I was unsuccessful. So I tried to convert my ejs file to jade and again my several attempts failed.
So I thought about just creating a HTML link that takes me to the ejs page on click. Problem is when I click it, nothing happens.
Here's how I made the link:
My Link.

Linking to local resources is disabled in all modern browsers due to security restrictions.
See this answers for more details.

check if the link is really file:///
or you can use double dot notation in your link
example:
../views/account/el.js
Hope it helps

Related

my project works with live server extension only

I have a live server extension in my VC and it works well, the problem is when I try to open my page without using the extension it shows up the page without any CSS colors or images or anything, I want to see my project with all CSS codes I wrote without using live server, thank you
Have your tried copying the full path of the file then entering it in the browser?
If that still doesn't work, try refresh the page when updating your html/css/js file.
Sharing your code will help us more to Debug it.
Instead, I suggest you,
Just recheck your internet connection if you're using any CDN or any API like Bootstrap, Tailwind CSS.
Check your links if referred to any external CSS or js.

HTML downloads page rather than content

I have been working on my website and when I tried to implement a download page, it didn't seem to work
Download as JSON file
Instead of downloading data.json, it downloaded the HTML download page. When I opened the file, rather than
{
"key":"value"
}
I found the HTML contents! How can I solve this?
Things I tried
Check for any spelling mistakes - none found
Checking syntax of entire page
Possible things that might affect whats going on
I am using Vue.js Server Side Rendering
No need to specify the argument in Download.
Try With only Download.
UPDATE
This is wrong. Keeping the answer for reference. See #tony19's comment.
The download attribute takes no argument, try
<a href="data.json" download>Download as JSON file</a>

React - How to modify the html inside root?

Maybe its a stupid question but:
I have an external Typescript-React app implemented into my code, but in order to add some CSS into one particular DIV (which doesnt have .class or #id) i need to reach the HTML code thats its inside root, how can i reach this HTML code?
Obviously i am able to see the code via Dev-tools but these changes doesn’t get saved after refreshing the page, and also I don’t think that modifying the web page via dev-tools could be considered as a good practice…
I tried to find the HTML file but its not inside my files or neither inside node_modules,
Thank you in advance,
Best Regards.
React HTML is all in JavaScript. In the node_modules, look for index.js and see if you can find the className or id attribute.
Alternatively, you can go to the github repo of the component and browse the code files.

Prevent URL from redirecting

This is the same question that has been asked elsewhere on the site but at the moment it's in the C# and .Net categories and so are the answers whereas i need to know how to do it in html.
So i'm trying to download the file at url http://example.com/example.docx and the url s being redirected to http://example.com/example.docx? so internet explorer doesn't recognize it although Google chrome does oddly. So i would like to know is there any way to avoid this happening by altering my html code?
Html Code is pretty standard...
<p>Link Text></p>
Finally if you type in http://example.com/example.docx manually it works
Thanks
The redirection is happening on the server side - it is doing the redirection at the end URL.
There is nothing you can do to your markup to change this.

How to link a relative html file in the scenario where user can call the files from the browser by adding a / at the end

(Sorry I am not able to frame question correctly.)
Following is the scenario.
I have 2 Html files.
File1.Html has
Click Me
File2.Html has
Click Me
Now when I open the file1.html in browser by typing following in browser.
http://Localhost/File1.html
The file1.html with a link is shown and when clicked it goes to
http://Localhost/File2.html
BUT
If I open the file1.html in browser by typing following in browser(note the / at the end).
http://Localhost/File1.html/
The file1.html with a link is shown and when clicked it goes to
http://Localhost/File1.html/File2.html
I know this is not a right way to do in browser but you cant stop user doing so.
The above example I have used just to simplify the issue. My real production issue issue is while using the MVC url are actually routed. So a user can legally use http://example.com/Employee Or http://example.com/Employee/ and due to this my jqGrid is not working.
Please guide me for a workaround.
UPDATE:
This works ok in IExplorer : wierd.
You want a link relative to the root. The following:
Click Me
(note the '/' at the start of the href) will link to http://Localhost/File1.html wherever the page containing the link is (so long as it's on the same host).
not relative to root i need it relative to parent
That's not possible. If you are using routed URIs there can be all sorts of /path/segments following the base name. The browser has no way of knowing what the real ‘parent’ is.
The usual solution is to use root-relative URIs as suggested by Joe. If you need to allow your application to be mounted at a configurable prefix under the root, that prefix will need to be copied out into the link.
Your question reminds me of a technique for search friendly URLs, implemented in PHP.
Things like:
http://localhost/index.php/2009/09/
It was described on Sitepoint.com The idea was that index.php could retrieve the trailing part of the URL from the web server and decide what to do with it. Including whether to deal with a final / or not.
It won't be relevant to html files (which could not, after all, retrieve the trailing part of a URL) but it might provide further ideas.