Another quick post. Working with AngularJS this morning I had a need for a link to redirect to a login page that was not contained within the “angular” part of the app. Unfortunately Angular was overriding the behavior and trying to route it.
The solution is fairly easy for this, simply add a target attribute:
Another quick one – how to stop a link from doing anything. I’ve just come across a need to use a link that acts as a button. A slight UI issue with this is that clicking a hyperlink will with an href value of ‘#’ will push scroll to the top of the page.
There are a couple of ways to go about fixing this. Note the href value in the following:
The second option is probably already familiar to anyone using ajax forms, simply have your function return false:
//Do some awesome stuff
//Return false to prevent link from affecting anything
The third option is simply a jQuery-ish rehash of number 2:
/* Does some awesome stuff while preventing the calling link from directing the user */
//Do some awesome stuff and then prevent the link from directing user
Just another quick problem I ran into with rails this afternoon – how to submit a form_for to a custom action. Luckily there’s quite a bit on how to do this in the documentation, my solution ended up as follows:
url_for(:controller => 'feedbacks', :action => 'leave_seller_feedback') do |f| %>
Just substitute your form_for tag with the one above and put in the relevant details and it should all work fine. Keep in mind that the submit tag doesn’t need to be changed, just the form_for tag.
This blog gives a brief overview of when to use flash.now[notice] and when to use flash[:notice]. A basic rule of thumb is that if you’re using a redirect, use flash[:notice], if you’re simply rendering a view, use flash.now[:notice].
Well, today I was looking through the Google Analytics overview of the WhatIBroke.com and I noticed a referral I hadn’t seen before from link.smartscreen.live.com.
I did a bit of Googling and it turns out that this is actually something Microsoft uses within IE and MSN. Apparently, whenever someone clicks on a link in msn the service will check the link against a list of unsafe sites and warn the user if anything is amiss.
It just so happens that I’d sent a link to the blog to a friend on msn – so I guess everything checks out. Here’s a bit of a blurb from the FAQ on Microsoft’s Site:
SmartScreen Filter is a feature in Internet Explorer that helps detect phishing websites. SmartScreen Filter can also help protect you from downloading or installing malware (malicious software).
SmartScreen Filter helps to protect you in three ways:
As you browse the web, it analyses webpages and determines if they have any characteristics that might be suspicious. If it finds suspicious webpages, SmartScreen will display a message giving you an opportunity to provide feedback and advising you to proceed with caution.
SmartScreen Filter checks the sites you visit against a dynamic list of reported phishing sites and malicious software sites. If it finds a match, SmartScreen Filter will show you a warning notifying you that the site has been blocked for your safety.
SmartScreen Filter checks files that you download from the web against a list of reported malicious software sites and programs known to be unsafe. If it finds a match, SmartScreen Filter will warn you that the download has been blocked for your safety. SmartScreen Filter also checks the files that you download against a list of files that are well known and downloaded by many Internet Explorer users. If the file that you’re downloading isn’t on that list, SmartScreen Filter will warn you.