The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Load a Frame from a URL, Can this be done
ckm
post Sep 6 2018, 08:29 PM
Post #1





Group: Members
Posts: 3
Joined: 6-September 18
Member No.: 26,707



I have a 3 frame website in which one frame contains a menu of blog articles that load in a difference frame when clicked on. I'd like to address the website via a URL that loads one of the blogs initially. Can this be done, and how?

Thanks
ckm
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Sep 6 2018, 10:36 PM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,549
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Well, once you have the page loaded copy the URL and paste it into a blank window to test.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Sep 7 2018, 04:12 AM
Post #3


.
********

Group: WDG Moderators
Posts: 7,966
Joined: 10-August 06
Member No.: 7



That's not possible, see http://htmlhelp.com/faq/html/frames.html#frame-address and http://htmlhelp.com/faq/html/frames.html#frame-problems
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Sep 7 2018, 05:34 AM
Post #4


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,096
Joined: 9-August 06
Member No.: 6



Depends on what the OP means.

Do you want this blog to always be loaded when people go to your frames page or only when you use a "special" URL?

I want to add that if those blogs aren't your own, it isn't exactly polite to frame other people's sites.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ckm
post Sep 7 2018, 09:08 PM
Post #5





Group: Members
Posts: 3
Joined: 6-September 18
Member No.: 26,707



I'd like to use special URLs that load specific blog pages (mine) into the main frame. By default it loads the first on the list but I'd like to pass URLs to clients in emails that load a specific blog.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Sep 7 2018, 11:18 PM
Post #6


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,096
Joined: 9-August 06
Member No.: 6



I think this is possible with JavaScript. By adding a query string to your URL, have JS read that query string and load the corresponding page. What say you, Christian?

There may be a little time lapse though. Never tried this, but I would expect so.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Sep 8 2018, 12:40 AM
Post #7


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,096
Joined: 9-August 06
Member No.: 6



I tested a little. Lets say your frameset looks like this.

CODE
<frameset cols="30%,70%">
   <frame name="menu" src="menu.html">
   <frame name="content" src="content.html">
</frameset>



Put a script block in HEAD of you frameset document with this.

CODE

function loadIt()
{
   var whatSite = window.location.search;
   whatSite = whatSite.replace("?site=", "");

   if (whatSite == 'htmlhelp')
      window.frames['content'].location = 'http://htmlhelp.com';
}

window.onload = loadIt;


Let's say your URL is http://example.com . If you access it with this URL http://example.com?site=htmlhelp then htmlhelp.com should load in the content frame. That is, you add a query string to the end of your URL in the format ?name=value.

You'd need to change the so it uses your name of the frame where the page should load and uses what you choose as querystring. And if you want to be able to load different sites this way you need to build on the if else a bit.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Sep 8 2018, 04:57 AM
Post #8


.
********

Group: WDG Moderators
Posts: 7,966
Joined: 10-August 06
Member No.: 7



You can also just use different static frameset files for each combination (no javascript needed). Making different frameset files is not more work that adding to the javascript whitelist of pages.

Beware of making a javascript that works automatically with any querystring (pandy's doesn't), that would save some work but also opens up the frameset to cross site scripting. Possibly you could make it only work for pages on your own domain. unsure.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Sep 8 2018, 05:30 AM
Post #9


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,096
Joined: 9-August 06
Member No.: 6



That's true. Didn't think of that. cool.gif

Also, I made a critical typo in the query string in the mockup URL above. Corrected now.
(I wrote ?=htmlhelp instead of ?site=htmlhelp)
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ckm
post Sep 13 2018, 01:54 AM
Post #10





Group: Members
Posts: 3
Joined: 6-September 18
Member No.: 26,707



Thanks Christian and Pandy! Those suggestions helped.
I got it working.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
hojiwar
post Oct 20 2018, 09:06 AM
Post #11





Group: Members
Posts: 1
Joined: 20-October 18
Member No.: 26,733





$("#button").click(function () {
$("#frame").attr("src", "http://www.example.com/");
});

HTML:

<div id="mydiv">
<iframe id="frame" src="" width="100%" height="300">
</iframe>
</div>
<button id="button">Load</button>

here online web programming tutorial https://www.welookups.com
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Oct 20 2018, 04:34 PM
Post #12


WDG Member
********

Group: Root Admin
Posts: 8,284
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



QUOTE(hojiwar @ Oct 20 2018, 07:06 AM) *

$("#button").click(function () {
$("#frame").attr("src", "http://www.example.com/");
});

HTML:

<div id="mydiv">
<iframe id="frame" src="" width="100%" height="300">
</iframe>
</div>
<button id="button">Load</button>

here online web programming tutorial https://www.welookups.com
This doesn't really address the issue the OP asked about.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 15th December 2018 - 04:48 AM