0

Herokuでsinatraアプリを実行しています。

私の問題: ローカルホスト (http://localhost:5000/) にアクセスすると、常に本番環境 (https://apps.facebook.com/myapp/) にリダイレクトされます。そのため、ローカルで開発することはできません。

私が追加したカスタム google アナリティクスが何か関係していると思われます。以下を参照してください (ソース: .グーグルアナリティクス)。これ

<script type="text/javascript">
// This script is provided AS IS without warranty of any kind.
// See http://www.savio.no/blogg/a/104/ for more information.
// Smacked together by Eivind Savio May 2011

var FacebookURL = 'http://www.facebook.com/YourFacebookPage?sk=app_123456789';

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-X']);
_gaq.push(['_addIgnoredRef', 'static.ak.facebook.com']);

// If Google Analytics is loaded and this page isn't framed inside our Facebook URL, frame the page.
if (_gaq.push && self.location == top.location) {
// Create a fake URL that we can filter in Google Analytics. This pageview also sends the traffic source data to Google Analytics.
_gaq.push(['_trackPageview','/facebook/campaign-tracking/']);
// Tracking done, let's frame the page
setTimeout(top.location.href = FacebookURL, 200);
} else if (self.location == top.location) {
// If Google Analytics doesn't load within 2 seconds, refresh and frame the page anyway. People dislike waiting. Change the time if you like.
setTimeout(top.location.href = FacebookURL, 2000);
} else {
// The Page is Framed. Let's track it.
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
}

(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>

だから私はそれを削除しましたが、heroku はまだそれを使用しています。以下のネットワーク コンソール出力の 3 行目を参照してください。何か案は?

[13:12:16.817] GET http://localhost:5000/ [HTTP/1.1 200 OK 395ms]
[13:12:17.330] GET https://apps.facebook.com/myapp/ [HTTP/1.1 200 OK 782ms]
[13:12:17.357] GET http://www.google-analytics.com/__utm.gif?xxxxxxxxxxxxxxxx [HTTP/1.1 200 OK 14ms]
[13:12:17.500] syntax error @ http://localhost:5000/:108
[13:12:18.326] POST https://xxxx.herokuapp.com/ [HTTP/1.1 302 Moved Temporarily 952ms]
[13:12:19.200] GET https://xxxx.herokuapp.com/ [HTTP/1.1 200 OK 734ms]
[13:12:19.827] GET https://xxxx.herokuapp.com/stylesheets/screen.css [HTTP/1.1 200 OK 262ms]
[13:12:19.829] GET https://xxxx.herokuapp.com/stylesheets/mobile.css [HTTP/1.1 200 OK 398ms]
[13:12:19.831] GET https://xxxx.herokuapp.com/javascripts/jquery-1.7.1.min.js [HTTP/1.1 200 OK 1032ms]
[13:12:20.093] GET https://xxxx.herokuapp.com/stylesheets/reset.css [HTTP/1.1 200 OK 135ms]
[13:12:20.096] GET https://xxxx.herokuapp.com/stylesheets/base.css [HTTP/1.1 200 OK 263ms]
[13:12:21.026] GET https://xxxx.herokuapp.com/images/house_suburb.jpg [HTTP/1.1 200 OK 308ms]
[13:12:21.051] GET https://xxxx.herokuapp.com/images/logo.png [HTTP/1.1 200 OK 295ms]
[13:12:21.109] GET https://www.facebook.com/dialog/oauth?api_key=xxxxxxxxxxxxxxxxcode&sdk=joey [HTTP/1.1 302 Found 192ms]
4

1 に答える 1

1

問題は次のことから生じます。

} else if (self.location == top.location) {
// If Google Analytics doesn't load within 2 seconds, refresh and frame the page anyway. People dislike waiting. Change the time if you like.
setTimeout(top.location.href = FacebookURL, 2000);
}

基本的に、「ページがフレーム化されていない場合は、FacebookのURLにリダイレクトしてください」と言っています

于 2012-05-31T00:07:21.310 に答える