SorrybutAVG

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, June 25, 2009

Displaying my web development idiocy

Posted on 9:23 AM by Unknown
I was messing around with creating a Widget here, and I wanted to take a remote web page, extract some info from it, and display it. I am just familiar enough with the concept of DOM, and recently educated myself enough on Javascript, that I am confident I could do it in about five minutes if I could just get the DOM of the remote web page loaded into a Document object.

But damned if I can't figure out how to do that...

First I tried putting it in an invisible iframe, but the problem is that the iframe might not be (actually, won't be) loaded when you go to start traversing its DOM tree. Then I thought maybe I could have an onLoad event for the iframe document, and go back and fix the HTML then... but it turns out that doesn't work, and a lot of people make that mistake. You have to put the onLoad handler in the frame itself, and... I can't do that, because I don't have control over the remote web page.

So then I started looking into Ajax, which I am pretty sure is the right thing, but I couldn't for the life of me get it to work. I don't really understand how to debug web stuff, so I am stuck. Gah!

On the plus side, I think I learned enough about DOM that I should be able to create a spiffy Javascript thingy to replace the horrible workaround I did to make those "Continue reading..." links appear at the bottom of the appropriate posts. Right now, I put a special label called "more" on each post where I want it (blech!) and then I hacked all the label-referencing code to omit that label. This has numerous disadvantages though.

However, with JS I should be able to get the div that includes the post, then search to see whether it contains the special div tag to hide the text below the fold. Shouldn't be too hard...

Update: Woo hoo, after much fumbling it worked! It probably would have taken me no time at all if I hadn't got confused and started searching for a div tag when I was actually looking for a span tag. D'oh!

Getting rid of that stupid "more" hack also fixed a problem I was having with my tag cloud. Ah, much better... now only if I could figure out AJAX...
Email ThisBlogThis!Share to XShare to Facebook
Posted in programming | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • If feminism killed chivalry, then chivalry kills common courtesy
    An argument that those who pine for the days of unrepentant misogyny are fond of repeating is the idea that gender equality has eroded tradi...
  • Gender politics and Automoblox
    Update: Jason Thibeault, who has a much larger readership than I, helped me publicize this issue (thanks Jason!)... and the co-founder sho...
  • Free will and hot peppers
    Daniel Dennett and Jerry Coyne are hanging around the former's apartment. Dennett goes to the kitchen, pulls a jalapeno from the coldes...
  • Why Cee Lo's word change to Imagine is really crappy
    I was not the only one to notice that Cee Lo Green, when performing John Lennon's Imagine just before the ball drop last night, change...
  • If you are liberal or atheist and you oppose the Park51 community center, you have been bamboozled
    It's infuriating, but probably not too surprising, how many conservatives don't understand the First Amendment. Regardless of how y...
  • Why I oppose the figurative use of the term "militant" in all contexts
    Uh oh, I go and call Bruce Hood a "nice guy" , and Bruce himself responds in the comments unfortunately triggering one of my big ...
  • Why is oxygen the third most common element in the universe?
    So it appears from several sources that the three most common elements in the universe are, in order, hydrogen, helium, and oxygen. The firs...
  • The evolutionary implications of our preference for the Maillard reaction
    This is something that has been bugging me the last couple of days... As many of the foodies out there may know, the Maillard reaction (pr...
  • Sorry, but AVG Secure Search is malware (Update: but maybe won't be in the next version)
    Discovered AVG Secure Search today when I installed the trial version of WinZip on a laptop that I only intend to use temporarily. There se...
  • Why the experience of anti-atheist prejudice is different, though similar, to prejudice regarding sexual orientation, race, gender, etc.
    At a post over at Prop8TrialTracker.com on the purging of the most vile homophobic elements from the mainstream anti-marriage equality move...

Categories

  • abortion
  • accomodationism
  • alternative medicine
  • apatheism
  • atheism
  • birther hilarity
  • bus ads
  • censorship
  • christian apologetics
  • christianity
  • civility
  • colbert
  • cooking
  • creationism
  • death
  • drinking
  • dualism
  • environment
  • evolution
  • facial hair
  • faith
  • feminism
  • file sharing
  • health care
  • hinduism
  • history
  • home improvement
  • intelligent design
  • islam
  • judaism
  • lgbt
  • local farming
  • lolcatz
  • math
  • misogyny
  • morality
  • mormonism
  • music
  • occupy
  • parenthood
  • peer review
  • philosophy
  • physics
  • politics
  • programming
  • racism
  • sikhism
  • skepticism
  • sustainable farming
  • trolls
  • vaccines
  • vegetarianism
  • video games
  • war on christmas

Blog Archive

  • ►  2013 (2)
    • ►  April (1)
    • ►  February (1)
  • ►  2012 (55)
    • ►  December (1)
    • ►  November (3)
    • ►  October (1)
    • ►  September (1)
    • ►  August (3)
    • ►  July (2)
    • ►  June (8)
    • ►  May (9)
    • ►  April (7)
    • ►  March (10)
    • ►  February (4)
    • ►  January (6)
  • ►  2011 (72)
    • ►  December (4)
    • ►  November (7)
    • ►  October (2)
    • ►  September (4)
    • ►  August (4)
    • ►  July (4)
    • ►  June (1)
    • ►  May (3)
    • ►  April (6)
    • ►  March (17)
    • ►  February (10)
    • ►  January (10)
  • ►  2010 (106)
    • ►  December (7)
    • ►  November (4)
    • ►  October (10)
    • ►  September (11)
    • ►  August (15)
    • ►  July (7)
    • ►  June (10)
    • ►  May (5)
    • ►  April (14)
    • ►  March (10)
    • ►  February (5)
    • ►  January (8)
  • ▼  2009 (171)
    • ►  December (10)
    • ►  November (5)
    • ►  October (19)
    • ►  September (26)
    • ►  August (38)
    • ►  July (52)
    • ▼  June (21)
      • Join Us
      • Relativism, Absolutism, Religion, and Alternative ...
      • At least they spelled "God" correctly...
      • More thoughts on gun control
      • Get Your Gunn
      • "Atheist" vs. "Nontheist"
      • Family Entertainment, Sharia style
      • Displaying my web development idiocy
      • ¡Viva la México!
      • That guy's horrible mustache
      • Getting certified to be a military chaplain
      • The atheism, cooking, and home improvement blog?
      • What happened to the cooking?
      • RIAA channels Dr. Evil
      • Expelled parody
      • Abolitionist Clergymen?
      • Beer can duck?
      • The Vaccine Meeting
      • Christian group actually sues for right to burn a ...
      • Into the Lion's Den...
      • The idea of this blog, and some random chicken recipe
Powered by Blogger.

About Me

Unknown
View my complete profile