Scripting News for 4/17/2007

New Samsung phone 

I got a new Sprint phone today, a freebie.

I posted a picture earlier, and a whole bunch of comments showed up. Maybe we can start a self-help group for clueless people like me. I can see it’s got a ton of features, but I can’t get started, I don’t even know what the number of my phone is.

CNET review of the Samsung SPH-M620 phone.

Politically incorrect questions 

1. How long before Bush connects what happened at Virginia Tech with the global war on terror?

2. How long before a Republican presidential contender says the Democrats want to take your guns away?

3. How long before one of the cable networks runs any story other than Virginia Tech?

3a. What’s Don Imus doing during all this michegas?

3b. Anna Nicole Smith?

4. Will anyone notice that while we’re venting and emoting about Virginia Tech, hundreds of Iraqis have died.

5. Okay, I suppose some people believe American lives are worth more than Iraqis, so what about the 3300 Americans who have died in Iraq. That’s about 100 times the number of people who died at Virginia Tech. What are we doing to prevent another 3300 deaths? Who’s responsible? Could those deaths have been prevented?

6. If you’re glued to your TV hanging on every word, when was the last time they said anything that even remotely qualified as news? (If you get bored, try playing a game, every time they say Virginia Tech, substitute Iraq.)

7. How long before Lou Dobbs raises the killer’s immigrant status?

Local image URL syntax?? 

I have a folder of images on my local disk.

If I drag one onto the Firefox icon in my toolbar, it displays.

The URL in the address bar is:

file:///flickrPics/pic42688.jpg

However, if I use that URL as the src attribute on an img element, I get a broken image.

<img src="file:///flickrPics/pic42688.jpg">

Question: Is there a way to get the browser to display an image coming from the local file system, and if so, what’s the syntax for the URL?

Sam Yates says it might be a Firefox security feature.

Via email, Wendy McCully writes: “As long as the HTML file that references the local images is in the same directory as the images themselves, you don’t need to indicate any path at all.” I tried it — and it works, without changing the browser’s security settings.

Today’s links 

NY Times: Corzine’s Speed Put at 91 M.P.H. Near Crash Site.

Scoble says always-on isn’t for him. Good move.

Michael Gartenberg has a Mac laptop question.

I got a new Sprint phone today — a freebie! :-)

Worth another look after three years.

Virginia Tech’s phones 

Roanoke Times: “When Virginia Tech wanted to alert students to developments in a recent campus manhunt for an accused double murderer it relied on e-mail, the Web and messages sent to dorm phones.”

Google search for “Virginia Tech” and “Rave Wireless.”

Andy Carvin: “I spoke with a PR rep at Rave Wireless today and she said that they have no relationship with Virginia Tech.”

Scoble’s cam 

Yesterday at the Web 2.0 Expo, I did a brief interview with Robert Scoble. I wondered what his camera hat looks like.

29 responses to this post.

  1. Hi Dave,

    I spoke with a PR rep at Rave Wireless today and she said that they have no relationship with Virginia Tech.

    Reply

  2. Dave, the file local syntax in your browser would be the complete path starting with HD name (as opposed to the local folder), or perhaps relative to the application or home directory). Example:

    file:///Users/raines/Desktop/Picture%209.png

    Reply

  3. Raines, of course that’s exactly what I did, and I got a broken image.

    Reply

  4. You can’t reference a local file:// url if the url for the base page is an http:// reference. It should work just fine if the original page is accessed from a file:// url

    Reply

  5. Posted by Lawrence on April 17, 2007 at 12:25 pm

    Have you tried calling html.getFileURL with the file path?

    Reply

  6. Posted by Sam on April 17, 2007 at 12:27 pm

    WRT local file path references in HTML, I have found it’s very dependent on the exact browser, OS, etc. It seems that the URI spec doesn’t dictate how to point to something generically across filesystems, so there is room for interpretation, which of course makes life difficult for us developers.

    If you are trying to setup a situation where a HTTP-served page references a local file, you might be bumping into this restriction (as opposed to a syntax/interpretation issue): http://kb.mozillazine.org/Firefox_:_Issues_:_Links_to_Local_Pages_Don't_Work

    I believe that’s there to prevent potential exploits by malicious remote web pages.

    Reply

  7. When I open a picture in the browser it includes the drive (e.g., file:///C:/Users/tomesnyder/Pictures/Idaho.bmp). Did you include the drive? If you are referring to having a website point to a picture on your computer I’m not sure that can be done unless your computer is a server.

    Reply

  8. Dave, the URL Raines lists should work. The three opening slashes in the file URL mean start from root. So in your example listed above, it would be something like “file:///Users/dave/flickrPics/pic42688.jpg”

    The other option is to specify a tag, something like:

    Then use relative image tags from then on:

    Reply

  9. Posted by chris on April 17, 2007 at 12:43 pm

    I think it will either work/not work depending on whether the request for the page is coming from a browser on your local machine or from a remote machine. It will work fine if you’re requesting the page with such an img tag AND you’re requesting from the same machine. But if I walk down the hall and use another system to request the same page, the img is broken because it isn’t located at that file:///path uri on THAT system.

    Reply

  10. Posted by chris on April 17, 2007 at 12:47 pm

    sorry to post again so soon, but I missed the comment above about Firefox. The local image will open fine in Safari when referenced from an html file, though. So it’s browser-based, unless you’re accessing from a remote machine (like an appleTV, like I assumed you were) :-)

    Reply

  11. Oops. WordPress ate the examples. Basically, you can put a BASE tag in the HEAD section of your HTML, with href=”file:…flickPics/” and from then on, all img tags can be just the filename.jpg.

    This all, btw, works fine in Firefox and Safari. If the original HTML file is local, browser security allows you to load local files. The security issue mentioned in a previous post has to do with HTML downloaded from the web and trying to access local URLs on your disk.

    Reply

  12. To everyone who’s barking up the wrong tree, I’ve tried ALL COMBINATIONS of file paths, with and without the drive name, etc. It’s not that.

    I’m pretty sure it’s the security issue, but I have to check it out before I’ll confirm it.

    Reply

  13. Posted by Ben Greenfield on April 17, 2007 at 12:49 pm

    The other possibility is that the flicker pictures are on one of your external drives.

    To find out a local file path that should work drag an image to an open terminal window. Copy the resulting file path into your browser. Or just drag the image to your open browser window just worked for me.

    Reply

  14. Posted by bryan on April 17, 2007 at 12:51 pm

    Viewing local files is restricted in firefox, but I believe that IE6(not sure on 7) will allow it through. Ran into a similar issue awhile back when trying to do image previews for an image uploading application. Wanted to show the image before it went up.

    Here’s a security advisory with a little more info.

    http://www.mozilla.org/security/announce/2006/mfsa2006-39.html

    Reply

  15. Hi Dave
    This works for me on WinXP (SP2) using FF2:

    C:\tmp\images\ dir contains image files.
    C:\docs\test.html page references them like:
    img src=”file:///C:/tmp/images/foo.jpg”

    enter this location in your browser:
    file:///C:/docs/test.html

    the FF security restriction is real and sometimes annoying (ran into this w our corporate intranet) but in the end, if you want to serve files use a server. running apache locally and accessing stuff in its docroot on localhost is trivial, and file:// references are by definition hacks, IMHO.

    /$0.02

    Reply

  16. “what about the 3300 Americans who have died in Iraq”

    I was going to argue that VA Tech hits us hard because we’re talking about kids, but no, the soldiers are mostly the same age. Maybe it’s because the students middle-class kids. Bringing back the draft would solve that.

    Reply

  17. Have you tried reversing the slashes?

    You didn’t say what OS you’re on.

    Reply

  18. Chris should have it right for Windows. You need specify the drive letter as well as the folder/share name

    Reply

  19. Dave,
    On my mac with firefox I can get this work.
    Referencing the image as src=”file:///Volumes/Touchstone/Mark/Desktop/Me.jpg” works. And if the html is saved on the desktop the relative path works: src=”Me.jpg”. Now if I save the html to my server and access it, Safari actually gives me the local image; this surprised me. Firefox gave me a broken image. When I look in Firefox’s error console I see this under messages: ‘Security Error: Content at http://www.photo-mark.com/test.html may not load or link to file:///Volumes/Touchstone/Mark/Desktop/Me.jpg.’

    Reply

  20. Posted by Larry Y on April 17, 2007 at 6:17 pm

    I couldn’t believe it when I heard on NPR that the smirking shirker went to V Tech.

    He’s the one who decreed that we can’t see returning caskets of the soldiers he sends to die.

    He’s the one who chooses not to attend military funerals.

    He must have been so happy to have heard of a mass murder for which he didn’t bear direct responsibility.

    Reply

  21. Dobbs isn’t likely to raise the issue. The gunman has been a *legal* immigrant since 1992.

    I’d kinda like it if Dobbs appeared on some other show, sorta like Bill O’Reilly appeared on Letterman, and someone would shove that fact in his face a bunch of times – and then point out that the colonists didn’t have immigration papers from native american tribes, and that our Founding Fathers were traitors to the crown.

    While they’re at it, they should point out that the areas of our country which have the most vibrant economic growth are the ones that get all the illegal immigrants, and here in Pennsylvania, we could definitely use some of those folks.

    Reply

  22. Here’s another thought:

    How long before someone blames Virginia Tech on hip hop and videogames, thus rather not elegantly avoiding the matter of gun control?

    Reply

  23. The next time that you are in the Palo Alto area, we’d be happy to help you learn your way around the Samsung M620. We know it well (see below).

    The first item on the tools menu is our favorite (Samsung Mobile Podcasts).

    Samsung Mobile Podcasts powered by VoiceIndigo is the first advertising-supported Podcasting service to ship bundled on a phone from a major handset manufacturer and a major carrier in the US.

    See also:

    http://mobilecrunch.com/2007/04/03/samsung-bundles-podcasting-on-mobiles/

    http://pushingthebarrier.typepad.com/pushing_the_barrier/2007/04/voiceindigo_and.html

    http://prro.marketwire.com/prroom/prro_details.do?id=353A15DD0A00F060&release_id=234728

    Reply

  24. Posted by Will Cate on April 18, 2007 at 3:49 am

    Perhaps none of your other regular readers are going to call you on this, but I certainly will.

    A soldier serving in Iraq is well aware of the daily risks or his/her situation. Do you think the Va. Tech victims woke up Monday morning thinking “hmmm… a crazed gunman just might slaughter me today?”

    Why on earth would you equate those two situations, other than just to make your political point?

    “Politically Incorrect” questions? Nope, just stupid questions, actually.

    Reply

  25. Posted by Neil Connolly on April 18, 2007 at 5:45 pm

    How long before someone blames the situation on Bush?
    -Already done, Rhandie Rhoades on Air America yesterday and today.
    How long before Democrats make a political situation out of it by wanting a gun control debate on day 2?
    -Already happened and the Governor of Virginia (Democrat by the way) lashed out that this is not a time to be having these debates.
    How long before someone makes a cheap political statement by tieing together two completely unrelated events?
    -Oops

    Reply

  26. Sorry! The code to display image is missed after posting, since it is HyperText! :D

    Here!

    I just started to write web page since Dec., 2006, I used to do in Visual FoxPro, so the coding may seem little odd to someone. Also, I don’t know it is safe to do so… : |

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 60 other followers

%d bloggers like this: