Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9273737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:11:02+00:00 2026-06-18T16:11:02+00:00

I have implemented some coffeescript that allows my table rows to be links. The

  • 0

I have implemented some coffeescript that allows my table rows to be links.

The issue I am having however is that my app seems to be adding http.com// into the beginning of my Job URLs so instead of getting www.google.com I would get www.http.com//www.google.com

I have the current setup:

#Coffeescript

$ ->
  $('tr[href]').click -> window.open 'http://' + $(this).attr('href');


#View
    <% @jobs.each do |job| %>
        <tr href='<%= job.job_url %>'>
            <td><strong><%= job.title %></strong></td>
            <td><%= job.company %></td> 
            <td><%= job.city %>, <%= job.country %></td>
        </tr>
    <% end %>

The URLs stored in my database all have www. as part of the URL but not http://.

Any advice on what might be going on here would be much appreciated. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:11:04+00:00Added an answer on June 18, 2026 at 4:11 pm

    job_url returns a complete url, e.g.

    http://www.example.com/jobs/1234
    

    whereas job_path returns a relative path, e.g.

    '/jobs/1234'
    

    If you are going to use job_url, you should NOT append the protocol in your coffeescript, as your URLs will be horked because they will be appending the protocol twice.

    You might also consider, as a best practice, to use data-href as the attribute on your <tr>. I try to do this, it makes the link between the HTML and the Javascript more explicit. I have spent many an hour tracking down bugs where the designer removed or renamed a class or attribute element that my Javascript was relying upon!

    So, in your ERB:

    <tr data-href='<%= job.job_url %>'>
    

    In the Coffeescript:

    $ ->
      $('tr[data-href]').click -> window.open 'http://' + $(this).attr('data-href');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some simple app, that I have implemented with design patterns. On the
I have already implemented some AJAX pagination in my Rails app by using the
I have implemented PullRefreshTableViewController with some classes that take no delegates, and it works
I have implemented a simple linux shell in c. Now, I am adding some
I have implemented some utility classes in Flex that I want to use in
I have create a class MyConnection that extends NSURLConnection. I have implemented some delegate
I have implemented some code that will automatically set a UIScrollView's ContentOffset when the
I have implemented Facebook in my application, and noticed that I have some problems
We have implemented some custom tooltip-drawing code that fires on Tick events of a
I have implemented some app preferences for my app. For strings they work great

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.