Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    New Coder
    Join Date
    Mar 2012
    Location
    North West
    Posts
    14
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Lightbulb errrr I'm trying to...

    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!

    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.

    Here's my current script:

    Code:
    <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

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

    Please help me, thank-you in advance.
    Last edited by SpongeRob; 10-03-2012 at 07:35 PM. Reason: Changed Quote to Code

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,872
    Thanks
    6
    Thanked 1,030 Times in 1,003 Posts
    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?

  • #3
    New Coder
    Join Date
    Mar 2012
    Location
    North West
    Posts
    14
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    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!

  • #4
    New Coder
    Join Date
    Mar 2012
    Location
    North West
    Posts
    14
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Anybody help please?

  • #5
    New Coder
    Join Date
    Sep 2012
    Location
    Boulder, CO
    Posts
    56
    Thanks
    5
    Thanked 0 Times in 0 Posts
    I'm not sure as to what you are trying to do. Why are you using frames?

  • #6
    New Coder
    Join Date
    Mar 2012
    Location
    North West
    Posts
    14
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by fireplace_tea View Post
    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!

  • #7
    Regular Coder
    Join Date
    Jul 2008
    Posts
    157
    Thanks
    9
    Thanked 13 Times in 13 Posts

    deprecated

    Thank goodness <FRAMESET> <frame></frame> </FRAMESET> is deprecated. Don't use frames; they just complicate things.

    Code:
    <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>
    Last edited by waxdoc; 10-07-2012 at 03:05 AM. Reason: add empahsis RED

  • Users who have thanked waxdoc for this post:

    SpongeRob (10-07-2012)

  • #8
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Quote Originally Posted by SpongeRob View Post
    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!
    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

  • #9
    New Coder
    Join Date
    Sep 2012
    Location
    Boulder, CO
    Posts
    56
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by SpongeRob View Post
    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!
    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.

  • #10
    New Coder
    Join Date
    Mar 2012
    Location
    North West
    Posts
    14
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by waxdoc View Post
    Thank goodness <FRAMESET> <frame></frame> </FRAMESET> is deprecated. Don't use frames; they just complicate things.

    Code:
    <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:

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

    Quote Originally Posted by DanInMa View Post
    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.

    ---

    Quote Originally Posted by fireplace_tea View Post
    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?
    Last edited by SpongeRob; 10-07-2012 at 05:53 PM. Reason: I forgot to anwser the other two users :-(

  • #11
    New Coder
    Join Date
    Sep 2012
    Location
    Boulder, CO
    Posts
    56
    Thanks
    5
    Thanked 0 Times in 0 Posts
    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.
    Last edited by fireplace_tea; 10-07-2012 at 06:21 PM.

  • #12
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    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:
    Code:
    <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:
    Code:
    <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:
    Code:
    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....

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

  • #13
    New Coder
    Join Date
    Mar 2012
    Location
    North West
    Posts
    14
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by patryk View Post
    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:
    Code:
    <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:
    Code:
    <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:
    Code:
    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....

    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:
    Code:
    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
    Code:
    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
    Code:
    <!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
    Code:
    <!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>
    ---

    Quote Originally Posted by fireplace_tea View Post
    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!
    Last edited by SpongeRob; 10-08-2012 at 03:52 PM. Reason: Coding link code

  • #14
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    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.ht...dingforums.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.ht...dingforums.com )

  • #15
    Regular Coder nomanic's Avatar
    Join Date
    Feb 2009
    Location
    United Kingdom
    Posts
    255
    Thanks
    9
    Thanked 33 Times in 33 Posts
    you could keep it in the text file, request the text file through ajax, then set the location.href to the result from ajax
    <DmncAtrny> I will write on a huge cement block "BY ACCEPTING THIS BRICK THROUGH YOUR WINDOW, YOU ACCEPT IT AS IS AND AGREE TO MY DISCLAIMER OF ALL WARRANTIES, EXPRESS OR IMPLIED, AS WELL AS DISCLAIMERS OF ALL LIABILITY, DIRECT, INDIRECT, CONSEQUENTIAL OR INCIDENTAL, THAT MAY ARISE FROM THE INSTALLATION OF THIS BRICK INTO YOUR BUILDING."
    <DmncAtrny> And then hurl it through the window of a Sony officer
    <DmncAtrny> and run like hell

    Portfolio, Tutorials - http://www.nomanic.biz/


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •