Question: How do I stop IE from stripping off parameters from file URI pasted into address bar?

Description of a problem: I have a "simpleTest.html" page with only this JS code inside, that returns the current location of the browser:

console.log("document.URL: " + document.URL);
console.log("document.location: " + document.location)
console.log("document.location.href: " + document.location.href)
console.log("window.location: " + window.location)
console.log("parent.frames.document.location: " + parent.frames.document.location)

When I paste the address to this file in IE's address bar with some parameters, for instance:


The link gets changed to:


When I paste it for the 2nd time the parameters will stay there. If however in the meantime I access some other resources, I will have to paste it 2 more consecutive times for the parameters to remain.

Moreover, after I've place the website in my local Apache and access it through HTTP, the parameters remained:

It works fine for FF and Chrome, for both file and http protocols. Any ideas about this strange behavior in IE?


file:/// will open a file on your drive or network drive using the OS. When using http:// you're telling the browser that this is a hypertext link to a file located on the Internet, not locally.

You're likely seeing the parameters after several tries because IE is just saving your history.

Also, having a ? in the URL implies you have some server-side scripting involved to process the URL parameter(s), which would not run unless through a web server.

  • Any idea how I could force IE to use browser engine instead of OS with a file protocol? Jun 7 '13 at 13:26
  • I'm afraid that's handled at the system-level (like calling 'system' in a program), so outside a user's control :-/ I coded a product with an HTTP server built in and had a similar problem...the only solution was to send the file via HTTP, which albeit is slower.
    – dan
    Jun 7 '13 at 14:02
  • One alternative is to use anchors with # instead of ?. That way it won't be removed, and you can still access it with JavaScript. Jul 2 '13 at 0:00
  • Even the anchor part does not pass to (my) IE8. What could be holding it back? Dec 15 '15 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.