Prevent URL from redirecting - html

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.

Related

Unable to use the top sites url of google chrome in html anchor tag

So I was making a cool homepage to replace my default homepage of google chrome of my phone, which I made
And I was trying to use the top sites provided by chrome to skip the extra work of adding sites manually
I somehow found the URL
chrome://explore
Which works as expected when entered manually in chrome
But when I use the URL in the href of the anchor tag, it simply doesn't work
Is there a way to make it work or any other website that provides the same thing
comment:
share some more details. Getting any errors in console or share your code.
ps: i can't add direct comment(newbie) that's why adding comment here.
It's not allowed for Chromium browsers. As it's not secure.
Long explanation:
If it were allowed - any website can request this with let's say fetch and read any of your chrome://history page.

An html online form debugger that transforms POST to GET

I'm quite new to web development, but I'm trying to do some stuff in Python and so I need help.
Sometime ago, I went into a page to debug html forms that allowed me to change the POSTs to GETs in the form request and that really helped me get some info from html forms by just doing everything in the URL instead of having to make my program fill some forms.
Unfortunately I lost that page address and as much as I search in Google I cannot come up with it or anything similar again. Can you direct me to some links that do this?
I tried both Firebug in Firefox and developer tools in chrome, but they don't seem to do this.
Ok, this is probably quite basic for most people, but in Firebug, you just have to go into the "NET" tab, make the request and then analyse it and if you right click it and choose: "Copy location with parameters" you get the formatted URL ready to go, even when using javascript.
If you have: <form name="form1">
You can this JavaScript:
document.form1.type="GET"
Use this in the page before submitting the form.
The web developer tool bar for firefox will do this and much more:
https://addons.mozilla.org/en-US/firefox/addon/web-developer/
EDIT
You can also use firebug and inspect the form element and change it from POST to GET

Google Chrome doesn't print my Javascript-and-AJAX-generated content

I am the developer of a webapplication.
Chrome displays my Javascript-and-AJAX-generated webpages correctly, but when I try and print them (via its native function) I get a blank page.
Printing works just fine on other browsers.
I have tried and print server-side-generated pages with Chrome and they get printed fine.
What can be wrong on the webpages of my web application? I think the issue is that those pages are dynamically generated by Javascript and AJAX.
I am saying that because I have just found out that I can't even save those pages correctly with Chrome (all the dynamic HTML is not shown).
I am on Google Chrome 13.0.782.112.
How can I debug and fix this issue?
Is there any workaround?
Is anybody managing to get dynamic-generated content printed with Google Chrome?
This problem is driving me crazy!
P.S.: some of my users are reporting the same problem on Safari :-(
UPDATE: upgraded to Chrome 14.0.835.202 but the issue is still there...
I've had exactly the same problem, though not in Chrome (although I didn't actually test with Chrome). On certain browsers (and I cannot remember which ones offhand - but it was either in IE or FF), any content that is added into the DOM by JavaScript is not printed. What is actually printed is the original document that was served to the browser.
I successfully solved this using the following JavaScript function:
function docw()
{
var doct = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
document.write(doct + document.getElementsByTagName('html')[0].innerHTML);
}
This is called when JavaScript page manipulation has finished. It actually reads the entire DOM and then re-writes the whole document back into itself using document.write. This is now enabling printing for my particular project on both IE and FireFox, although I'm pretty sure one of those did already work in the first place, and the other one didn't (can't remember which from memory, and it's not a project I can pull out to test at the moment). Whether this will solve the problem in Chrome I don't know, but it's worth a try.
Edit Terribly sorry, but I'm a complete pleb. I just re-read my old comments and this solution had nothing to do with printing; it was actually to fix a problem where only the original served document would be saved when saving to file. However, that said, I still wonder if it's worth a shot.
This helped me with a related problem - how to view/save dynamically generated HTML itself. I came up with the following bookmarklet.
javascript:(function(){document.write('<pre>'+(document.getElementsByTagName('html')[0].innerHTML.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'))+'</pre>')})()
I run this and 'select all' / copy, and then (in Linux) do 'xclip -out' to direct the large amount of clipboard data to a file.
Trevor's answer totally worked for me- with jquery I simply did something like
$("html").html $("html").html()
worked perfectly

Cannot link to chrome://newtab

I'm trying to provide a link to chrome://newtab (the new tab page) for my distraction-preventing page for when I need to access it, however clicking the link gives the error Failed to load resource.
I've tried:
Linking to it using <a href="chrome://newtab">
Attempting to redirect the user using window.location.
The chrome: prefix aliases to chrome:// but still fails to load.
Does anyone know if this is possible or has any ideas to try?
I am not sure why it doesn't work, but I think it is for security reasons.
Pages on the internet should not have access to local resources and the new tab page is a local resource.
Format your link thusly (also will work with firefox and other tabbed browsers):
Click me
EDIT: of course, that's not actually the new tab page. It's just a blank tab. Going to leave it anyways.
I think you'll have to write a Chrome extension to get access to the chrome://newtab link, it doesn't seem possible for an ordinary webpage to access it.
Edit: This solution no longer works, but I'll leave it for anyone that might try to hunt down why it stopped working.
I finally found that https://www.google.com/_/chrome/newtab will open chrome://newtab, thanks to this post.
Don't ask me why.

File:// link doing nothing in all browsers

I have a link being generated that looks like so:
<a target="_blank" title="Test" href="file:///c:/test.xls">Test</a>
This link is inside an iframe.
When I click on it (in any major browser), nothing happens. Fiddler records no traffic.
Pasting the URL into the nav bar works fine - the file download box comes up, and I can download the file no problem.
I've tried every variant of the URL structure (correct and incorrect, colons, slashes, backslashes, etc.) that I can think of.
I'm certain that it's some kind of security restriction, but I can't for the life of me find out what it is or how to get around it. I'm feeling pretty foolish at this point. Any simple explanations?
Sorry, if you are pulling this page off of a server (acessing it as http://), the security settings won't let you link to local content (acess links as file://). I've had this same problem accessing shared .doc files in a wiki. Never came up with a good solution.
Try a colon instead of a pipe ;)