Ich brauche eine URL in iframe auf meiner eigenen Seite zu zeigen ... so schreibe ich:Encode URL und zeigen in iframe
Route::get('/preview/{url}', '[email protected]');
meine Reglerfunktion:
public function preview($url) {
$url = urlencode($url);
return view('pages.preview', compact('url'));
}
und offcource meine Klinge Vorschau Seite (JavaScript):
function preview(){
function autoResize(id){
var newheight;
var newwidth;
if(document.getElementById){
newheight = document.getElementById(id).contentWindow.document .body.scrollHeight;
newwidth = document.getElementById(id).contentWindow.document .body.scrollWidth;
}
document.getElementById(id).height = (newheight) + "px";
document.getElementById(id).width = (newwidth) + "px";
};
var content = '<iframe id="iframe2" src="{{$url}}" style="border:0px #FFFFFF none; position: relative;left: 0px;width: 100%; height:100%; top: 0;" name="myiFrame1" scrolling="yes" frameborder="0" marginheight="0px" marginwidth="0px" height="100%" width="100%" onLoad="autoResize(iframe1);"></iframe>';
var newNode = document.createElement("DIV");
newNode.innerHTML = content;
document.body.appendChild(newNode);
};
preview();
Jetzt, wenn ich versuche, so etwas wie:
http://localhost:8888/preview/http%3A%2F%2Fwww.dubaimajestic.com%2F
oder
http://localhost:8888/preview/http://www.dubaimajestic.com
ich:
Not Found The requested resource /preview/http%3A%2F%2Fwww.dubaimajestic.com%2F nicht auf diese gefunden wurde Server.
Wie man das zum ARBEITEN macht? Irgendwelche Ideen?