0
我正在顯示一個文本,例如讓我們考慮文本爲「SOF」。當點擊一個超鏈接jquery應該工作,頁面不應該導航 - jquery
當我點擊「SOF」文本時,我在iframe中顯示了我的網站中的特定網站。
這種情況是工作的罰款...
但我的問題是,當我點擊「SOF」文本的iframe裝載以及頁面也完全導航到同一個頁面。這不應該發生。我在這裏給我的代碼。什麼是防止重定向整個網站的方法。
編輯:
這個URL工作正常:http://www.oercommons.org/browse/collection/free-ed-gov
該網址無法正常運作:http://www.merlot.org/merlot/viewMaterial.htm?id=79516
可能是什麼問題.. :-(
注意:我知道jquery不需要在iframe中顯示網站。但在我的情況下,有時我會顯示HTML,PDF等...所以我需要使用jQuery。 :-)
var xhr = null;
//by default set the element properties
var preview_on = true;
Drupal.behaviors.previewOverview = function(context) {
//show preview on mouse over
$('.links a').click(function(e) {
e.preventDefault();
if (xhr && xhr.readyState != 4) {
//if previous ajax is working then cancel it
xhr.abort();
//$('#right-sidebar-right').html('Preview Panel.');
}
if (preview_on) {
curLink = this;
targetLink = this.href;
data = '<div><a href='+ targetLink +' target="_blank">View Original Page</a></div>' + '<iframe src="' + targetLink + '" width="100%" height="500px"></iframe>';
// To display the data in selected area.
$('#right-sidebar-right').html(data);
}
} else {
$('#right-sidebar-right').html('Turn on preview mode to view.');
}
});
剛纔我發現其實... merlot.org網站已經阻止他們在iframe中顯示他們的網站。所以,該網站加載到iframe中,然後通過會話立即重定向到URL。 – Fero