[英]How to embed a webpage in another website
我正在嘗試從另一個網站嵌入日歷,但我不太明白如何。 我嘗試了嵌入和腳本標簽,似乎沒有任何效果。 另外,我不明白最后的 JSON 指令。
Go to https://www.crestinortodox.ro/embed/agendacrestinului/listacalendar/mycss/
and you can use this calendar on your webpage.
Use the 'callbackjs' parameter for JSON-P.
我知道這聽起來像是一個新手問題,但我真的不知道如何處理 URL。 我不想將它嵌入為 iframe,我希望它包含在網頁代碼中,以便我可以使其響應,添加 CSS 等等。
這是一個添加代碼並為其創建 CSS 的網站:ww.bisericaicoanei.ro - 在右側,其中顯示日歷 Ortodox。
您可以使用跨域資源共享將頁面內容放在 div 或任何標簽中。
例如:
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200) {
document.getElementById('displayDiv').innerHTML = xhr.responseText;
}
};
xhr.open('GET', 'https://some.example.com', true);
xhr.send();
然后您需要在服務器端代碼中設置Access-Control-Allow-Origin
header,例如在 php 中:
<?php
header('Access-Control-Allow-Origin: http://api.google.com');
header('Access-Control-Allow-Origin: http://some.example.com');
?>
查看此答案以獲取更多信息: https://stackoverflow.com/a/41498465/11365636或
您可以使用<enbed>
元素,例如:
<embed src="https://github.com/AbrarJahin/Asp.NetCore_3.1-PostGRE_Role Claim_Management/"
width=200
height=200
onerror="alert('URL invalid!');" />
或者
您可以使用<object>
元素,例如:
<object data="https://github.com/AbrarJahin/Asp.NetCore_3.1-PostGRE_Role-Claim_Management/"
width="400"
height="300"
type="text/html">
Alternative Content
</object>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.