开发者

javascript run from web browser [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vag开发者_StackOverflowue, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

i was wondering if you people could give me an example code for people to type in their address bar to automatically download something from a web address just by typing in that javascript line. Thanks


Isn't that how URLs work already? Download something when you just type in the web address?

No JavaScript Needed!™


I'm gonna take a wild guess and assume your problem is that the file is opening in the browser, but instead you want it to be downloaded. That's not really a JS problem. You need to set/change the mime-type of whatever file you want people to download. application/__ usually works. _ being the type of file. look here: http://www.w3schools.com/media/media_mimeref.asp

There's also this other header which is sort of an extension of MIME you can add:

Content-disposition: attachment; filename=someFileName

More on that here: http://support.microsoft.com/kb/260519

If it's something that's generated through php, you can throw this at the top:

More info would be useful so I supply you with a better example.


This should do it:

javascript:window.location.href=http://images.google.com/search?tbm=isch&hl=en&source=hp&biw=1482&bih=801&q=you+people%3F%21&gbv=2&aq=f&aqi=g3g-m7&aql=f&oq=


Sounds like you need BookMarklet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜