I've added the javascript for Google Analytics by using TYPO-Script (in Template):
page.headerData.124034 = TEXT
page.headerData.124034.value (
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push (['_setAccount', 'UA-##-my-ID-##']);
_gaq.push (['_gat._anonymizeIp']);
_gaq.push (['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- Google Analytics End -->
)
TYPO3 renders on frontend:
<!-- Google Analytics -->
<!-- Google Analytics End -->
So the complete script-section is missing. My code worked on TYPO6 6.1.3 very well. I think it stopped working when i updated to TYPO3 Version 6.1.4 or 6.1.5.
Has anyone a idea how get it to work again?
Maybe the TEXT-Type do not accept script tags anymore.
Try to use:
page.includeFooterJS.c (
<script type=”text/javascript”>
alert(“Yes, scripts can also be added inline.”);
</script>
)
Or:
http://typo3.org/extension-manuals/footer_js/0.0.1/view/1/3/
Probably there is sth wrong with your template, e.g. some other template is overriding this value.
Have you checked if you see correct value in the Template object browser?
I have tested the exact code you have shared and it worked without an issue in TYPO3 v8.7
Related
I would like to redirect site to mobile version only for android versions below a certain build, specifically below Ice Cream Sandwich, that is API level 14
I am able to at present only redirect for a certain build and unable to redirect for a range of builds. Please suggest how to redirect for a range of builds.
This is the code which I am using -
<script type="text/javascript"> // <![CDATA[
if ( (navigator.userAgent.indexOf('Android 4.2.2') != -1) ) {
document.location = "http://www.yoururladdress.com/yourpage.html";
} // ]]>
</script>
Found answer to this question.
Code is as follows -
<script>
<!--
var str = navigator.userAgent ;
var version = str.match(/Android\s+([\d\.]+)/)[1];
var version = version.substring(0, 3);
if(version <= 4.0)
location.replace("http://www.yoururladdress.com/yourpage.html");
}
-->
</script>
trying to get the ad slot working on my site. I ad a set of test slot that were working pretty good, then I removed these and created proper named ones. But now, the request url keep returning NetworkError: 400 bad request...It's about to make me go crazy. I have verified and the url is not outsite the 2k char limit.
I build a little test page that is pretty simple, but its still not showing the ad. I have a default "House" line item ad set in that ad unit but it's just now showing. I can see the iframe in the code but it's empty due the the error.
My normal code is more complex with more ad unit and responsive code, but the test one is really simple:
<html>
<head>
<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
googletag.cmd.push(function() {
googletag.defineSlot('/xxxxxxxx/OCR-rightsidebar-skyscraper', [160, 600], 'div-gpt-ad-1414630314403-5').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
<body>
<!-- OCR-rightsidebar-skyscraper -->
<div id='div-gpt-ad-1414630314403-5' style='width:160px; height:600px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1414630314403-5'); });
</script>
</div>
</body>
</html>
Is there something I don't see here?
Did anyone ever experienced 400 with pubads.g.doubleclick.net?
Any idea how to solve this?..I searched, but everything I came accross so far was not helpful at all.
Thanks
Setup:
Got a working facebook app and am correctly setup for facebook credits transactions (i.e. everything on the serverside is working fine).
In Firefox and chrome transactions complete without issue, however in IE8 the callback upon completing/closing the purchase dialog throws the following errors:
Error 1:
Line: 52 Error: Object doesn't support this property or method
Object doesn't support this property or method JScript - script block, line 52 character 37
Where the function it points to is:
ui: function( params )
{
obj = FB.JSON.parse( params );
method = obj.method;
cb = function( response ) { FBAS.getSwf().uiResponse( FB.JSON.stringify( response ), method ); }
FB.ui( obj, cb );
},
Specifically highlighting this bit:
FBAS.getSwf().uiResponse( FB.JSON.stringify( response ), method )
in the http://connect.facebook.net/en_US/all.js file
Error 2:
Line: 65 Error: Object doesn't support this action
Object doesn't support this action all.js, line 65 character 2198
[The line it points to is a stupidly long unformatted unreadable mess so I'll omit it unless requested]
Specifically highlighting this bit:
delete d._old_visibility
again in the http://connect.facebook.net/en_US/all.js file
The html I'm using (with the app identifying stuffs removed) is as follows:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Expires" content ="0" />
<meta http-equiv="Pragma" content ="no-cache" />
<meta http-equiv="Cache-Control" content ="no-cache" />
<title>[ APP NAME ]</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript">
$(document).ready
(
function()
{
var appId = [ APP ID ];
var host = [ APP HOST ];
// If the user did not grant the app authorization go ahead and
// tell them that. Stop code execution.
if (0 <= window.location.href.indexOf ("error_reason"))
{
$(document.body).append ("<p>Authorization denied!</p>");
return;
}
// Loads the Facebook SDK script.
(function(d)
{
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
// When the Facebook SDK script has finished loading init the
// SDK and then get the login status of the user. The status is
// reported in the handler.
window.fbAsyncInit = function()
{
//debugger;
FB.init(
{
appId : appId,
status : true,
cookie : true,
oauth : true,
});
FB.getLoginStatus (onCheckLoginStatus);
};
// Handles the response from getting the user's login status.
// If the user is logged in and the app is authorized go ahead
// and start running the application. If they are not logged in
// then redirect to the auth dialog.
function onCheckLoginStatus (response)
{
if (response.status != "connected")
{
top.location.href = "https://www.facebook.com/dialog/oauth?client_id=" + appId + "&redirect_uri=" + encodeURIComponent (host+"[ RELATIVE APP PATH ]") + "&scope=publish_stream,user_about_me,read_friendlists,user_photos";
}
else
{
// Start the application
loadGame();
}
}
}
);
function loadGame()
{
var flashvars = {};
var params = {};
var attributes = {};
params.allowscriptaccess = "always";
attributes.id = 'flashContent';
attributes.name = 'flashContent';
swfobject.embedSWF("[ APP SWF ]?"+Math.floor(Math.random()*10000), "flashContent", "100%", "99%", "10.0", null, flashvars, params, attributes);
}
</script>
<div id="flashContent" >
Loading...
</div>
</body>
This is just a problem for IE 8 but is stopping the app going live since a significant number of users transactions would fail (or rather would complete, be charged and not take effect due to the failed callback).
For the past few days I've been searching for others with this or a similar problem but to no avail.
I've seen some similar issues where people are warned about javascript variables being created globally and causing interfereance or variables being names using keywords reserved in IE but as far as I can tell neither is the case here. The facebook javascript code is fairly boilerplate stuff lifted from facebook dev pages and reliable sources. It may be JQuery (which I have little experience with), however, again, this is lifted from working examples and if there is a problem I can't see it.
Can anyone help?
SOLVED
I won't accept this answer because I honestly don't think the question was answerable/solvable with the info provided and feel it would be bad form. But I want to leave this here for anyone that might be looking for a solution.
Cause of the error
The problem is the result of the combination of facebook hiding the app during 'normal' facebook actions (in this case, displaying the pay prompt) and external interface calls not working in Internet explorer when the app is hidden/not visible.
Solution
Found at http://flassari.is/2012/02/external-interface-error-object-expected/#comment-1743
All of these steps may not be neccessary but in the end what I did was:
Stop facebook hiding the app by overriding the visibility using
<style>
#[ ID OF THE FLASH OBJECT]
{
visibility: visible !important;
}
</style>
Adding wmode = "opaque"; to the swfobject params
Using the optional flash_hide_callback by adding hideFlashCallback:"OnHideFlash" to the FB.init options in the actionscript to move/hide the app instead, where OnHideFlash is a javascript function:
function OnHideFlash(params)
{
if (params.state == 'opened')
{
getSwf().style.top = '-10000px';
} else
{
getSwf().style.top = '';
}
}
Where getSwf() is your prefered method of getting the flash app object.
Hopefully this will save some people the suffering of pouring through the endless 'reasons that XYXY doesn't work in IE' questions and solutions that has been my last few days.
I suggest putting your code through a JavaScript Lint tool and correcting any errors you find. IE8 is extremely picky about how JavaScript is coded, while Firefox and Chrome are ok with minor mistakes. If your code is error free (after linting), it should work properly.
I'm using facebook fanbox instead of likebox because fanbox has css property.
I embedded this js file:
<script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/cs_CZ"></script>
cs_CZ shoud have changed my locale settings, translate my fanbox but nothing happens. Is it somehow possible to change language of my fanbox (I know it's deprecated but whatever...)
Thanks
I know it's deprecated but whatever... ... erm, yeah. That.
It's been replaced with the Like button / box (some time ago) which does take a locale.
If the old, deprecated plugin doesn't work anymore with a locale, they've disabled that feature.
Ok, I got it!
Actually, you have to mix old API with new API (wondering how long this will work ;) )
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({ appId: 'yourPageIdHere', status: true, cookie: true, xfbml: true});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol + '//connect.facebook.net/cs_CZ/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<fb:fan profile_id="yourPageIdHere" stream="1" connections="0" logobar="0" width="280" css="your.cssfilehere?1"></fb:fan>
I want to use google web font "Over the Rainbow" when composing mail in gmail
<link href='http://fonts.googleapis.com/css?family=Over+the+Rainbow&v2' rel='stylesheet' type='text/css'>
Is it possible?
<script type="text/javascript">
WebFontConfig = {
google: { families: [ 'Over+the+Rainbow' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})(); </script>
I wish the answer were different, but I do not believe it is currently possible.
I don't believe Gmail will allow you to insert a link element into the message body (although some email clients will).
Gmail will not allow you to run JavaScript within the message.