我打開這個線程,因爲我嘗試了很多我在這裏找到的方法,或者在我的自定義樣式表插入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的按鈕/鏈接即可。再次感謝。 –