群里有個人想在微信頁面里面加彈出框。作為前端的我,想着不可能這樣做。后來一個人說了:
A:如果對方沒有防盜鏈的話,你可以建個頁面,內置iframe 到他的頁面,然后把url 的參數也傳入你的iframe。廣告什么的就在你的主頁面彈就好了
B:咋實現啊?
A:或者你可以做的酷一點。就是用模擬http 請求預先獲取他的頁面內容,然后重新排版渲染到你的頁面上
A:或者你可以做的酷一點。就是用模擬http 請求預先獲取他的頁面內容,然后重新排版渲染到你的頁面上
B:很多盜版小說網站都是這么干的
我於是想到了一個解決方案:
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 <style type="text/css"> 7 *{padding:0px;margin:0px;} 8 body{position:relative;} 9 html,body,iframe{height:100%;} 10 .adv{width:300px;height:200px;background-color:pink;position:absolute;bottom:500px;right:0px;} 11 </style> 12 </head> 13 <body> 14 <iframe src="https://www.baidu.com/index.php?tn=monline_3_dg" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe> 15 <div class="adv">你的窗口!</div> 16 </body> 17 </html>
效果截圖:
原來是可以的,又學習了。
