Cloud Stack Ninja

I have a php file which is been used to share posts of my users on Facebook and Twitter. If I click on the Twitter icon for example, I get a screen where the hyperlink to my site is automatically been written. This is good, but I like to remove the www. part of the url that is automatically shown on the Twitter screen. I guess this has something to do with location.host, so I googled, but I couldn't find a proper answer to this problem.

Here is an example of my code:

function e(f,i,an)
{
        with(document)
        {
                write('<div style="width:100%"><table id=m'+i+' style="visibility:hidden"><tr>');
                write('<td id="vst' + i + '" style="white-space:nowrap">&nbsp;</td>');
                write('<td hr(this.childNodes[0])" title="share on facebook"><a href="javascript:od(\'http://www.facebook.com/sharer.php?u=' + location.host + '/e/'+ i +'\',900,400)" class=icon><img src="images/facebook.png" target="_blank"></a></td>');
        write('<td hr(this.childNodes[0])" title="share on twitter"><a href="javascript:od(\'http://twitter.com/home?status=' + location.host + '/e/'+ i +' - %20read!\',800,600)" class=icon><img src="images/twitter.png" target="_blank"></a></td>');
                write('<td class=ei><a name="cid'+i+'"></a><a href="e/'+i+'">( #'+i+' )</a></td>'); 

                  document.write('<td>&nbsp;</td>');

My second question would be this: how can I add a custom title on the Twitter screen: for example, my websitename without having to use location.host together with the title of the TOPICNAME that is being shared?



Read more here: https://stackoverflow.com/questions/12543746/javascript-location-host-without-www

Content Attribution

This content was originally published by 1BJK903 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: