...

View Full Version : errrr I'm trying to...



SpongeRob
10-03-2012, 06:34 PM
OK, I've been at this for a while now and I've been Googling so much that I've seen the first four or five pages of search results for a number of different search terms. My eyes are now turning square and frankly it's time for me to ask for help please! :eek:

What I want to do is to write a plain text file containing a websites URL. Then I want to be able to load the site mentioned in the text file in a new tab using my non default browser (Firefox). The problem is that I am using FRAMES and I'm punching above my weight. :confused:

Here's my current script:



<frameset rows="98,*" frameborder="no" border="0" framespacing="0">
<frame src="PageA.html" scrolling="No" noresize="noresize" id="topFrame" />
<frame src="url.txt" id="mainFrame" />
</frameset>


Obviously once loaded the top frame is fine and the main frame only contains the contents of the URL.txt file :mad:

So how do I change/rewrite my script to do what I want please?

Please help me, thank-you in advance. :thumbsup:

VIPStephan
10-03-2012, 10:35 PM
Plain text is plain text. You can’t do anything with it in a browser except display it as and where it is.
I’m not completely getting what you are trying to do yet. Do you want to click the URL in the text file to load a new page or is the new page supposed to open as soon as the text file is loaded in the browser?

SpongeRob
10-04-2012, 10:58 AM
Plain text is plain text. You canít do anything with it in a browser except display it as and where it is.
Iím not completely getting what you are trying to do yet. Do you want to click the URL in the text file to load a new page or is the new page supposed to open as soon as the text file is loaded in the browser?

Thanks for replying Stephan, this idea is for part of my local intranet.

Basically I'm trying to put a banner in the top frame and have the bottom frame work as normal. However I want the users to have the ability to change their homepage easily and simply without having to edit any of the webscript.

I'll keep my fingers crossed please! :thumbsup:

SpongeRob
10-06-2012, 04:05 PM
Anybody help please?

fireplace_tea
10-06-2012, 08:54 PM
I'm not sure as to what you are trying to do. Why are you using frames?

SpongeRob
10-06-2012, 10:14 PM
I'm not sure as to what you are trying to do. Why are you using frames?

Thanks for your reply Fireplace_Tea, OK here's what I am trying to achieve with my limited knowledge.

Top frame (approx 100 pixels high) - Centered company intranet banner, I'm using hotspots on the banner image to link to other important pages.

Main frame - Displaying the users homepage, in this frame they are free to browse the net.

The hardship that I am trying to overcome is having a local text file (or something similiar) containing the users home page, so that each user can have their own homepage and it is easy to edit their individual homepages from machine to machine. They cannot edit their own homepage url as I have disabled it from Internet Options using Internet Explorer.

Of couse if somebody has a better way of doing all of this then I am willing to change how I've gone about doing this! :thumbsup:

waxdoc
10-07-2012, 02:03 AM
Thank goodness <FRAMESET> <frame></frame> </FRAMESET> is deprecated. Don't use frames; they just complicate things.



<frameset cols="25%,*,25%">
<frame src="frame_a.htm">
<frame src="frame_b.htm">
<frame src="frame_c.htm">
</frameset>

http://www.accessv.com/~email/webpages/frames.html


A web page with frames is actually made up of several pages put together into one. This page for example is made of three pages: One for the top, another for the main section, and a third one which brings them together.
You can see that this page has two frames, the top frame containing the page with the title, and the bottom frame containing the page with the sidebar and main content. Webpages within the frames are written just like any other html file but the page which brings them together has it's own set of html tags. Here's how the code looks for this page:

<html>

<head>
<title>frames</title>
<head>
<frameset rows="30%,70%">
<frame src="title.html" />
<frame src="main.html" />
</frameset>

</html>

Notice that the html file starts out just like any other web page except there are no body tags. In their place are the opening and closing frameset tags.

The rows attribute in the frameset tag makes horizontal frames, vertical frames are made with the cols attribute. The numbers determine how much of the web page the frames will take up, in the example the top frame takes 25% and the second frame 75% of space. The percentages need to be distributed so that they add up to 100% and notice they are enclosed in quotation marks. Each percentage is separated by a comma.

Next come the frame tags, they are single tags so they have a slash at the end. The src attribute is telling the browser which web page is to display in the frame by default (when the visitor arrives on the web page). In the example the first frame holds a web page with the file name "title.html" and the second frame holds a web page named "main.html".

More frames can be put on a web page by adding more frame tags to the code. To remove frame borders add the border="0" attribute into the opening frameset tag like so:

<frameset rows="25%,75%" frameborder="0">

Linking From Framed Web Pages
To get links working properly on framed web pages, each frame needs to be named so that the anchor tags will know into which frame to send the destination web page when a link is clicked. This is done by putting the name attribute into the frame tags like so:

<frame src="main.html" name="myframe" />
The name of the frame can be anything, once the frame is named, the link is directed to it through the target attribute in the anchor tags:

<a href="testage.html" target="myframe">Your link</a>
The target attribute told the link to send the web page into a frame named myframe. The target attribute can also force links to break out of frames completely and load like a regular web page when its value is set to "_top" like so:

<a href="testage.html" target="_top">Your link</a>

DanInMa
10-07-2012, 02:31 AM
Thanks for your reply Fireplace_Tea, OK here's what I am trying to achieve with my limited knowledge.

Top frame (approx 100 pixels high) - Centered company intranet banner, I'm using hotspots on the banner image to link to other important pages.

Main frame - Displaying the users homepage, in this frame they are free to browse the net.

The hardship that I am trying to overcome is having a local text file (or something similiar) containing the users home page, so that each user can have their own homepage and it is easy to edit their individual homepages from machine to machine. They cannot edit their own homepage url as I have disabled it from Internet Options using Internet Explorer.

Of couse if somebody has a better way of doing all of this then I am willing to change how I've gone about doing this! :thumbsup:

I think I get it. You want to have your company banner at the top of the browser regardless of where your users go.
Unfortunately, many sites use code to force themselves out of frames, so there really isn't a perfect solution. Most places, jsut control the users homepage via a GPO, and add it to their favorites via gpo as well. They should know how to use favorites by now ;)

fireplace_tea
10-07-2012, 04:55 AM
Thanks for your reply Fireplace_Tea, OK here's what I am trying to achieve with my limited knowledge.

Top frame (approx 100 pixels high) - Centered company intranet banner, I'm using hotspots on the banner image to link to other important pages.

Main frame - Displaying the users homepage, in this frame they are free to browse the net.

The hardship that I am trying to overcome is having a local text file (or something similiar) containing the users home page, so that each user can have their own homepage and it is easy to edit their individual homepages from machine to machine. They cannot edit their own homepage url as I have disabled it from Internet Options using Internet Explorer.

Of couse if somebody has a better way of doing all of this then I am willing to change how I've gone about doing this! :thumbsup:

OK...I think I know what you want now. But first: GET RID OF FRAMES!!!!
Second, what you are looking to do is typically done on the server side, not the client side like you are trying to do. It usually requires a membership login so each user can be served their own page and make changes to their own page only. For an example, think of Facebook (I will assume you have a facebook account). Everyone signs in and has their own homepage. Within your home page you can make a lot of changes such as who is allowed to access your homepage, which emails you get and so on. All info that you edit is saved in a database on a server and retrieved from the database when you login from any PC, MAC or mobile device. In short, it is all server based.

Let me know if I understood what you are looking to do. Thanks.

SpongeRob
10-07-2012, 04:32 PM
Thank goodness <FRAMESET> <frame></frame> </FRAMESET> is deprecated. Don't use frames; they just complicate things.



<frameset cols="25%,*,25%">
<frame src="frame_a.htm">
<frame src="frame_b.htm">
<frame src="frame_c.htm">
</frameset>

http://www.accessv.com/~email/webpages/frames.html

Thank-you Waxdoc, very informative and a more refined method of dealing with frames. I've rewritten my pages taking all of this onboard. I really appreciate your help :-)

Yes seemingly frames are a must. I am doing different thing in the different frames and I would be unable to easily do this in one page.

I have one slight problem remaining, is there anyway that we can make the modification of the users homepage easier? Ideally running the URL from a text file?

Currently my code for the main browsing window (89%) is as follows:



<head>
<meta http-equiv="REFRESH" content="0;url=http://www.users_homepage_example.com" name="mainframe">
<title>Users homepage example</title>
</head>
</html>


---


I think I get it. You want to have your company banner at the top of the browser regardless of where your users go.
Unfortunately, many sites use code to force themselves out of frames, so there really isn't a perfect solution. Most places, jsut control the users homepage via a GPO, and add it to their favorites via gpo as well. They should know how to use favorites by now ;)

Thanks DanInMan, yes I understand unfortunately for example some users will not be connected to the company network. For example a laptop which has been taken out into the field or taken home etc. It may then be connected to a users home network or 3G dial up USB modem.

---


OK...I think I know what you want now. But first: GET RID OF FRAMES!!!!
Second, what you are looking to do is typically done on the server side, not the client side like you are trying to do. It usually requires a membership login so each user can be served their own page and make changes to their own page only. For an example, think of Facebook (I will assume you have a facebook account). Everyone signs in and has their own homepage. Within your home page you can make a lot of changes such as who is allowed to access your homepage, which emails you get and so on. All info that you edit is saved in a database on a server and retrieved from the database when you login from any PC, MAC or mobile device. In short, it is all server based.

Let me know if I understood what you are looking to do. Thanks.

Thanks Fireplace_Tea, as per WaxDoc's advise I have now rewritten my pages (but am still using frames) and I think that is what DanInMa was saying. My answer is the same, unfortunately it's not 100% practical to do it all server side.

---

OK so to roundup, my thanks to everybody who has helped so far. My pages have been successfully rewritten and are still functioning with FRAMES! (Unfortunately I'm unaware of a solution to rid myself of frames and still do everything that I want to do)

The minor issue that I am now faced with is trying to make it easier to adjust the homepage. If anybody can suggest a method of reading the homepage from a text file then that would be fantastic.

Another alternative would be to link a popup dialogue box requesting the homepage if we could somehow store it in a file so that it can be called from the mainframe html file?

Suggestions and solutions please?

fireplace_tea
10-07-2012, 05:19 PM
I am getting a better picture of what you are trying to do. The BEST thing you can do is learn Java and write a client application. Java is designed and allowed to dive into the OS file system, where JavaScript\HTML\CSS are not designed to dive into the OS file system (thus physically can not do it). There may be some weird way to do it with another small language...I suggest you do a google search and see what you can find out. You will want a language that can access the OS file system and talk to your webpage.

OH, and as far as getting rid of frames, try using normal CSS layout techniques and see if iFrames will do the trick for you.

patryk
10-08-2012, 01:03 AM
How about passing arguments in url instead of storing them in txt file?
I would imagine it's even simpler to create shortcuts/bookmarks than creating txt files ;)

if you have your frameset like that:


<frameset rows="98,*" frameborder="no" border="0" framespacing="0">
<frame src="PageA.html" scrolling="No" noresize="noresize" id="topFrame" />
<frame src="" id="mainFrame" />
</frameset>

then all you need to do is putting little javascript in your document:


<script language="javascript">
function getValue(name){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ){
return '';
}else{
return results[1];
}
}
function updateSRC(){
document.getElementById('mainFrame').src = getValue('theURL');
}
</script>

then you change <body> to <body onload="updateSRC()">

and call your document like that:
http://somedomain.com/document.http?theURL=http://something.com/blah.html

whatever you put after 'theURL' in address bar will be used as src of your frame
...that will work for you assuming i understood purpose of your question.... :D

and btw text file aproach won't fly since modern browsers work in sandboxes limiting access to local file system

SpongeRob
10-08-2012, 02:44 PM
How about passing arguments in url instead of storing them in txt file?
I would imagine it's even simpler to create shortcuts/bookmarks than creating txt files ;)

if you have your frameset like that:


<frameset rows="98,*" frameborder="no" border="0" framespacing="0">
<frame src="PageA.html" scrolling="No" noresize="noresize" id="topFrame" />
<frame src="" id="mainFrame" />
</frameset>

then all you need to do is putting little javascript in your document:


<script language="javascript">
function getValue(name){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ){
return '';
}else{
return results[1];
}
}
function updateSRC(){
document.getElementById('mainFrame').src = getValue('theURL');
}
</script>

then you change <body> to <body onload="updateSRC()">

and call your document like that:
http://somedomain.com/document.http?theURL=http://something.com/blah.html

whatever you put after 'theURL' in address bar will be used as src of your frame
...that will work for you assuming i understood purpose of your question.... :D

and btw text file aproach won't fly since modern browsers work in sandboxes limiting access to local file system

Hi Patryk and thanks for your reply, yeah I like the idea of this however I'm struggling to implement it.

My problems are:

(1) Can you confirm where to put the Javascript please? I assume you mean in index.html?

(2) If so, as it's a frameset I don't have any <Body> tags. I though that was the way that Frames were supposed to be coded? OK so I've tried adding it regardlessly.

(3) Finally I assume you don't mean save the file like this:
http://somedomain.com/document.http?theURL=http://something.com/blah.html but instead call it to the browser like that? Again if so how do I get around if the file isn't hosted? Can this be done locally? I tried altering the URL to read
C:\Users\MyComputer\Desktop\index.html?theURL=http://www.google.ie but it failed saying it couldn't find what was written in the address bar.

I do like the idea of this workaround, if you could please assist me in getting it working? My Current files read as follows:

Index.html


<!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=iso-8859-1" />
<script language="javascript">
function getValue(name){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ){
return '';
}else{
return results[1];
}
}
function updateSRC(){
document.getElementById('mainFrame').src = getValue('theURL');
}
</script>
<title>Test File</title>
<frameset rows="14%,86%" frameborder="0">
<frame src="header.html" name="topframe"/>
<frame src="" name="mainframe"/>
</frameset><noframes></noframes>
<body onload="updateSRC()">
</body>
</head>
</html>


Header.html


<!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=iso-8859-1" />
</head>
<body>
<table width="730" height="92" background="images/logo.gif" cellpadding="12" cellspacing="0" align="center" onClick="JavaScript:void(window.open('http://www.company_website.com'))">
</table>
</body>
</html>


---


I am getting a better picture of what you are trying to do. The BEST thing you can do is learn Java and write a client application. Java is designed and allowed to dive into the OS file system, where JavaScript\HTML\CSS are not designed to dive into the OS file system (thus physically can not do it). There may be some weird way to do it with another small language...I suggest you do a google search and see what you can find out. You will want a language that can access the OS file system and talk to your webpage.

OH, and as far as getting rid of frames, try using normal CSS layout techniques and see if iFrames will do the trick for you.

Thanks Fireplace_Tea, yeah I would love to learn Java and have looked a sections before. Main reason I haven't done anything further is that I've always managed to somehow do whatever I am trying to do either by figuring it out myself of by getting help from other people.

I've Googled for this for many hours without much luck, ironically it seems to be a possibility for Mac OS. I'll certainly look into the CSS and iFrames idea, but unfortunately that still wouldn't get me around the text homepage issue currently faced. Thanks for your help so far up to this point.

In fact a big thank-you for everybody who has contributed thus far. Fingers crossed Patryk's solution will solve my problems if I can get it working!

patryk
10-08-2012, 05:57 PM
you have simple example with one iframe here: http://freedockstar.com/test/test.html
if you'll call it with parameter like:
http://freedockstar.com/test/test.html?theURL=http://www.codingforums.com
you'll see what's happening. take look at source.
also if you can't make a shortcut to local file with parameters, then sollution is simple. host the file somewhere. U can make shortcuts for websites with GET values afterall (just like you can make shortcut to http://freedockstar.com/test/test.html?theURL=http://www.codingforums.com )

nomanic
10-08-2012, 11:55 PM
you could keep it in the text file, request the text file through ajax, then set the location.href to the result from ajax

nomanic
10-09-2012, 12:02 AM
text file (page.txt) -
http://www.google.com

in your bottom frame load this page-


<script type="text/javascript">
var json,iC=false,dsTA=[],dTA=[],cTA=[],rTA=[],ajs=[],qwt=-1,htp=(document.all)?(new ActiveXObject("Microsoft.XMLHTTP")):(new XMLHttpRequest());
l_8=function(r){return r?r.length:0;};
sT=function(n,t){return setTimeout(n?n:"",(t?t:10));};
ob=function(o,q){return (typeof o==='string')?((o==='')?q:document.getElementById(o)):o;};
sC=function(w,r,f){cTA.push(w);rTA.push(r);ajs.push(f);if(qwt!==-1){clearTimeout(qwt);}qwt=sT("cQ();",100);};
cQ=function(w,r){if(!iC&&(l_8(cTA)>0)){w=cTA.shift();r=rTA.shift();iC=true;htp.open('post',w);eval("htp.onreadystatechange="+r);htp.send(null);}qwt=(l_8(cTA)>0)?sT("cQ();",5000):-1;};


caller2=function() {
if (htp.readyState===4){
iC=false;
ft=ajs.shift();
location.href=htp.responseText;
}
};
sC("page.txt",caller2,[]);
</script>


if you wanted to pass parameters, pass the name of the text file, assuming its going to change everytime

patryk
10-09-2012, 12:37 AM
and this will access txt file on client's computer?....cmon

SpongeRob
10-09-2012, 11:07 AM
text file (page.txt) -
http://www.google.com

in your bottom frame load this page-


<script type="text/javascript">
var json,iC=false,dsTA=[],dTA=[],cTA=[],rTA=[],ajs=[],qwt=-1,htp=(document.all)?(new ActiveXObject("Microsoft.XMLHTTP")):(new XMLHttpRequest());
l_8=function(r){return r?r.length:0;};
sT=function(n,t){return setTimeout(n?n:"",(t?t:10));};
ob=function(o,q){return (typeof o==='string')?((o==='')?q:document.getElementById(o)):o;};
sC=function(w,r,f){cTA.push(w);rTA.push(r);ajs.push(f);if(qwt!==-1){clearTimeout(qwt);}qwt=sT("cQ();",100);};
cQ=function(w,r){if(!iC&&(l_8(cTA)>0)){w=cTA.shift();r=rTA.shift();iC=true;htp.open('post',w);eval("htp.onreadystatechange="+r);htp.send(null);}qwt=(l_8(cTA)>0)?sT("cQ();",5000):-1;};


caller2=function() {
if (htp.readyState===4){
iC=false;
ft=ajs.shift();
location.href=htp.responseText;
}
};
sC("page.txt",caller2,[]);
</script>


if you wanted to pass parameters, pass the name of the text file, assuming its going to change everytime

Thank-you very much Nomanic this solution is working and reading the URL from the text file! :thumbsup: :D :cool:

I really appreciate everybodies input, and fantastic help. Thanks guys.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum