有没有办法在phonegap中拥有一个(“X-Frame-Options:SAMEORIGIN”)网站:
或者用其他术语来说:我想将 google.com 嵌入到我的 PhoneGap 应用程序中:这可能吗? (我尝试使用 iframe 但没办法)
(我使用intel SDK crosswalk)
最佳答案
您可以使用 Cordova 应用内浏览器插件打开外部网站。这将弹出一个模式窗口,其中包含您指定的网站。
下面是打开 google.com 的示例代码,请确保您已从 Intel XDK -> 项目设置 -> 插件中选中“在应用程序浏览器中”插件
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=no">
<script src="cordova.js"></script>
<script>
function openIAB(){
var url = "http://google.com";
window.open(url, "_blank", "location=yes");
}
</script>
</head>
<body>
<button onclick="openIAB()">Open Google</button>
</body>
</html>
应用程序浏览器中cordova插件的文档:https://github.com/apache/cordova-plugin-inappbrowser
关于cordova - 是否可以在phoneGap中嵌入 'X-Frame-Options: SAMEORIGIN"网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30314416/