PDA

View Full Version : pass iframe src in link



mitcham
10-28-2008, 02:20 AM
I am trying to pass the iframe src in a link.

eg http://www.domain.com/framed_page.html?<iframe src=http://cnn.com/newsitem.html">

So that it goes to page framed_page.html that contains an iframe, and the src parameter is derived from the link.

This may be simple html, or needs a script. I also tried

Link http://www.domain.com/framed_page.asp?keyword=http://cnn.com/newsitem.html

Then in framed_page.asp

<%
Dim keyword
varkeyword = Request.form("keyword")
%>
<iframe name="I1" src=<%= Request.QueryString("keyword") %> width="700" height="700">

</iframe>


Basically trying to dynamically build a page with using the same skeleton but different SRC.
Any help appreciarted.

student101
10-28-2008, 11:57 AM
Ok try this;

main.php => filename


dirname="page/" 'change as needed
mypath = "page/" 'change as needed
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(server.mappath(dirname))
Set filez = folder.Files
FileCount = folder.Files.Count
response.write "<p>There are <b>" & FileCount & "</b>" & " files</p>" 'change as needed

For Each listing in filez
TotalChars = len(listing.name)
Title = left(listing.name,TotalChars - 4)
Title = replace(Title,"_"," ")
response.write "<a href='framed-page.asp?path=" & mypath 'change framed-page.asp?path as needed
response.write listing.name
response.write "' class=""menu"" target=""_new"">" 'change as needed
response.write Title
response.write "</a><br>"
Next
framed-page.asp => filename

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Framer</title>
</head>

<body>
<% iframeSource = request.querystring("path") %>
<iframe src="<%= iframeSource %>" border=3 frameborder=0 marginheight=0 marginwidth=0 width="100%" height="100%" name="iframeElement" id="iframeElement" scrolling=none></iframe>
</body>
</html>
Make a folder called page 'change as needed in main.asp then add some files, HTML if possible or whatever you want - ASP|PHP|Blah, Blah

passme.asp => filename


<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pass me</title>
</head>

<body>
<h1>Passed page</h1>
<p>Hello I my path is ...</p>
</body>
</html>
What you want to do seems sneaky.
This code in NO way supports your plans for whatever you want to do with it.
If it's sneaky!
Cheers