How can I add xmlns namespace to <html> tag in meteor

This is what I'm trying to accomplish (to integrate Facebook send button using addthis)

<html xmlns:fb="http://ogp.me/ns/fb#">

However the html is out of my control. Meteor also forbids adding attributes to <head> such as:

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">

Workarounds that serve the same purpose are more than welcome.

Answers


I'm not sure how to change it through the raw source. But you can use something in your rendered callback to get to it via:

Template.hello.rendered = function() {
    $('html').attr("xmlns:fb","http://ogp.me/ns/fb#");
    $("head").attr("prefix", "og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#");
}

This uses JQuery to modify the html tag as soon as Meteor renders the DOM.


Adding the following line in your server side code will resolve your first question.

WebApp.addHtmlAttributeHook(function (request) { return 'xmlns:fb=http://ogp.me/ns/fb#'; });

I have no idea about your second question...

UPDATE: Certainly you need to return an object in Meteor 1.0. WebApp.addHtmlAttributeHook(function (request) { return {'xmlns:fb': 'http://ogp.me/ns/fb#'; });


This worked for me:

WebApp.addHtmlAttributeHook(function (request) { return {"ng-app":"helloWorld"}});

(I wish I could put this as a comment on http://stackoverflow.com/a/16142297/5203563 but I don't have enough points to comment - I'll upvote it)

This also seems to work to get it added on the client side:

Meteor.startup(function() {
  $('html').attr('ng-app', 'helloWorld');
});

Need Your Help

Simple Active Directory and powershell combo , issues

powershell active-directory powershell-v2.0

Well today i decided i want to have some fun with AD and PS so i bascially decided i want to write a script to access my dc and and its ou and sub ou's and grab all my windows servers deployed. how...

how can i use this fileupload in a form?

jquery asp.net-mvc-2

hi i found this fileupload today and it kinda fits like a glove for a form im doing, my only problem is how do i upload this file to server? i know it say to put it in a form but im still confused....

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.