Я искал высоко и низко для решения, но не могу найти его. Я использую Google Docs Viewer для просмотра файлов PDF. Это отличный инструмент, но я не могу заставить его работать в Internet Explorer (7 или 8). Все мои изображения появляются как значок «отсутствует». Если я просмотрю файл извне, он, кажется, загрузится нормально, и он начнет работать (я предполагаю, что изображения кэшируются). Документ отображается в iframe
и работает во всех других браузерах. Кто-нибудь придумал решение, чтобы заставить его работать в IE? Если нет, есть ли альтернатива, которая может отображать PPT и PDF-файлы?Google Docs viewer в IE
ответ
Единственное решение, которое я нашел по этой проблеме, заключается в том, чтобы добавить https://docs.google.com на свои надежные интернет-сайты.
У меня такая же проблема, но не думаю, что было бы приемлемо просить пользователей добавлять URL-адрес на свои надежные сайты в IE.
К счастью, я наткнулся на following post:
Встроенная версия Google Docs Viewer (GView) не будет загружать свои изображения правильно, если третья сторона куки отключены. Эта проблема является проблемой для большинства пользователей IE, поскольку по умолчанию она будет отключена. Ниже я расскажу об этой проблеме, по крайней мере, до тех пор, пока Google не добавит p3p. Оригинальное обсуждение проблемы можно найти на форуме справки google docs.
Я пробовал это, и он работает в IE8, IE7 и IE6.
Спасибо, хорошая ссылка! – Skoder
codeinthehole или @Skoder: У меня такая же проблема, но ссылка в ответе больше не работает. Не могли бы вы предоставить решение, пожалуйста? :) – rassom
@rassom Я только что нашел скрипт на github, https://github.com/cyclops1982/NOMAC/blob/master/wp-content/plugins/google-document-embedder/proxy.php – fboaventura
Я знаю, что это старый вопрос, но поскольку проблема по-прежнему сохраняется, и я наткнулся на этот вопрос с ответом, указывающим на пустой сайт, вот фактический код сценария, упомянутого в @codeinthehole answer, на всякий случай кому-то это нужно. (Может быть найдено, на этот раз, GitHub)
<?php
# This proxy code is a bypass for an existing flaw in Google Docs Viewer that breaks the functionality
# for some IE users. If you do not wish to use this code, select Google Standard Viewer rather than
# Enhanced Viewer in GDE Settings. Note that viewer toolbar customization options depend on this
# proxy workaround remaining enabled.
#
# The problem this code addresses is discussed at length on Google's Help Forum:
# http://www.google.com/support/forum/p/Google+Docs/thread?tid=22d92671afd5b9b7&hl=en
#
# This code is based on the work of Peter Chen. For more information, see:
# http://peterchenadded.herobo.com/gview/
#
# Peter's code is modified below to allow for cURL fallback, viewer toolbar customization,
# and to reflect changes in the viewer since the code was first released.
// test for allow_url_fopen in php config; try curl for function if disabled
if (ini_get('allow_url_fopen') !== "1") {
if (function_exists('curl_version')) {
$curl = 1;
} else {
$err = "This function is not supported on your web server. Please add ";
$err .= "<code>allow_url_fopen = 1</code> to your php.ini or enable cURL library. ";
$err .= "If you are unable to do this, please switch to Google Standard ";
$err .= "Viewer in GDE Options.";
echo $err;
exit;
}
}
if (isset($_GET['embedded'])) {
// get the src page, change relative path to absolute
if (isset($curl)) {
$code = curl_get_contents("http://docs.google.com/viewer?" . $_SERVER['QUERY_STRING']);
} else {
$code = file_get_contents("http://docs.google.com/viewer?" . $_SERVER['QUERY_STRING']);
}
// fix path to images
$search[] = "/viewer/images";
$replace[] = "http://docs.google.com/viewer/images";
$search[] = "/gview/images";
$replace[] = "http://docs.google.com/viewer/images";
// proxy the javascript file
$search[] = "gview/resources_gview/client/js";
$replace[] = "?jsfile=gview/resources_gview/client/js";
if (isset($_GET['gdet'])) {
$gdet = $_GET['gdet'];
# hide google icon (i)
/* These are no longer visible by default - not necessary
if (strstr($gdet, 'i') !== false) {
$search[] = ".goog-logo-small {";
$replace[] = ".goog-logo-small { display: none !important;";
}
# hide single/double page view (p)
if (strstr($gdet, 'p') !== false) {
$search[] = ".controlbar-two-up-image {";
$replace[] = ".controlbar-two-up-image { display: none !important;";
$search[] = ".controlbar-one-up-image {";
$replace[] = ".controlbar-one-up-image { display: none !important;";
}
*/
# hide zoom in/out (z)
if (strstr($gdet, 'z') !== false) {
$search[] = "#zoomOutToolbarButtonIcon {";
$replace[] = "#zoomOutToolbarButtonIcon { display: none !important;";
$search[] = "#zoomInToolbarButtonIcon {";
$replace[] = "#zoomInToolbarButtonIcon { display: none !important;";
}
# hide open in new window (n)
if (strstr($gdet, 'n') !== false) {
$search[] = "#openInViewerButtonIcon {";
$replace[] = "#openInViewerButtonIcon { display: none !important;";
}
}
$code = str_replace($search, $replace, $code);
header('Content-type: text/html');
echo $code;
} else if (isset($_GET['a']) && $_GET['a'] == 'gt') {
// get text coordinates file, can not redirect because of same origin policy
if (isset($curl)) {
$code = curl_get_contents("http://docs.google.com/viewer?" . $_SERVER['QUERY_STRING']);
} else {
$code = file_get_contents("http://docs.google.com/viewer?" . $_SERVER['QUERY_STRING']);
}
header('Content-type: text/xml; charset=UTF-8');
echo $code;
} else if (isset($_GET['a']) && $_GET['a'] == 'bi') {
// redirect to images
header("Location: http://docs.google.com/viewer?" . $_SERVER['QUERY_STRING']);
header('Content-type: image/png');
} else if (isset($_GET['jsfile'])) {
// proxy javascript files and replace navigator.cookieEnabled with false
if (isset($curl)) {
$code = curl_get_contents("http://docs.google.com/" . $_GET['jsfile']);
} else {
$code = file_get_contents("http://docs.google.com/" . $_GET['jsfile']);
}
$search = array("navigator.cookieEnabled");
$replace = array("false");
$code = str_replace($search, $replace, $code);
header('Content-type: text/javascript');
echo $code;
} else {
// everything else, of which there isn't!
header("Location: http://docs.google.com/viewer?" . $_SERVER['QUERY_STRING']);
}
function curl_get_contents($url) {
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
return $file_contents;
}
- 1. Получение встроенного google docs viewer для работы в IE 7,8
- 2. API для Google Docs Viewer
- 3. Отображение битовых потоков в Google Docs Viewer
- 4. Google Docs Viewer не показывает .xlsx файл
- 5. Google Docs Viewer - время ожидания запроса файла
- 6. Google Docs Viewer дает пустое пространство
- 7. Рисунки Google Docs и IE
- 8. Является ли Google поэтапным отказом от Google Docs Viewer?
- 9. Google Docs Viewer иногда не загружает контент в iframe
- 10. .docx и xlsx файл не просматривается в google docs viewer
- 11. Обновить документ в Google Docs Viewer (Clear Cache)
- 12. Язык на google docs
- 13. Как Google Docs PDF Viewer позволяет копировать и вставлять?
- 14. Google Docs viewer возвращает 204 ответа, больше не работает, альтернативы?
- 15. Google Docs Viewer дает ошибку javascript внутри страницы ASP.Net
- 16. Плохая рендеринг изображений с помощью Google Docs PDF viewer
- 17. google docs viewer не работает для некоторого url
- 18. как распечатать iframe google docs viewer открыть документ
- 19. Google Docs viewerng api reference
- 20. google docs не работает в ie6
- 21. Вставить google docs без публикации
- 22. Google Docs для просмотра отключить загрузки
- 23. Google Drive import Google Docs
- 24. Интеграция с Google Docs
- 25. clearContents на Google Docs
- 26. auto login google docs
- 27. Android Google Docs - Форма
- 28. Google Docs имитирует клавиатуру
- 29. Google docs live translation
- 30. AIDL registerCallback() google docs
Я думаю, этот вопрос принадлежит суперпользователю, не уверен. однако, это работает для меня – Matias
Привет, Я пошлю его к суперпользователю, если потребуется. Я думал, что я разместил его здесь, поскольку это больше на стороне разработки. Вы имеете в виду, что Docs Viewer работает для вас в IE в первый раз (например, документ, который вы никогда не открывали раньше)? – Skoder