我打开这个线程,因为我尝试了很多我在这里找到的方法,或者在我的自定义样式表插入iframe的jQuery中,但没有一个能够工作。 现在我卡住了。 我打开任何建议,对我来说,没有必要与jQuery做,如果有任何其他的灵魂人物。插入样式表到iframe中
这是我现在有:
<!doctype html>
<html lang="hu">
<head>
<meta charset="utf-8">
<title><?php echo $this->title; ?></title>
<link rel="stylesheet" type="text/css" href="css/style.css" media="all" />
<script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
<script src="js/mootools-more.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#iwiw').load(function(){
$('#iwiw').contents().find('head').append('<link href="css/iwiw.css" rel="stylesheet" type="text/css" />');
});
});
</script>
</head>
<body>
<header><!-- content --></header>
<div id="container">
<div id="left">
<iframe id="iwiw" src="http://iwiw.hu/like.jsp?u=<?php echo $url; ?>&title=<?php echo str_replace('+', '%20', urlencode($this->title)); ?>&t=tetszik&s=white" width="220px" height="120px" style="border: none;" scrolling="no" frameBorder="0"></iframe>
</div>
<div id="right"><!-- content --></div>
</div>
<footer><!-- content --></footer>
</body>
代码$网址
是用urlencode和$这个 - 编码的当前网址>标题是当前页面的标题,正如你可以看到我的文档类型是html5和你没有看到的是,iframe的SRC是XHTML过渡。
其实iframe是原始的工作代码,如果你想测试它,只需用你的网站的URL和$ this->标题替换你的网站标题。
逸岸你可以使用其他领域,如果你控制 - 拥有它,通过域之间发布消息。 –
哦,谢谢。我没有考虑跨域限制。比我想我会从iframe中获取共享链接,只需创建一个不带iframe的按钮/链接即可。再次感谢。 –