World Wild Web > ⁇ ∙ Tutorials

GUIDE: How to fix links on a frame site! - MK Frame-Link System

(1/2) > >>

Melooon:
 :defrag: :defrag: :defrag: Hi all, a quick guide here with a free script!

As some of you know Im a fan of frames sites, those are sites that use the frameset system for page layout. If you need help with frames have a look at my site and a look at this tutorial too https://www.tutorialspoint.com/html/html_frames.htm.

The big issue with frameset sites though is that they don't save browser history properly, you cant share links to sub pages and the back button does not work.. crappy stuff! BUT I have a fix for all of that and I'll share it here! Example: Instead of just going to https://melonking.net/melon, you can now visit https://melonking.net/melon?z=/links to jump to a particular framed page.

PREMADE TEMPLATE:
I have attached "frames-template.html" this is a template frame site layout you can download and use! It also explains a little about how to modify the frames! (If you download the template you don't need to install the script yourself, its pre-setup :grin:smile:

How to Install (Works for iFrame sites tooo!!)
Add this code to the <head> of your frameset page or main page containing your iFrame (Typically your index.html)

--- Code: ---<script src="https://melonking.net/scripts/frame-link.js"></script>
--- End code ---

Then add id="mainframe" to your main <iFrame> or Frameset <frame> tag.

Done!

Optional Steps
Optional: Create a second <script></script> section AFTER you link the frame-link.js
Optional: add updateTitle = false; if you want to disable title updating. (Default is true)
Optional: add titlePrefix = "My Site "; if you want to add a prefix to your titles. (Default is none)
Optional: add pageParam = "z"; if you want to change the url path of your pages. (Default is z)
Optional: if you use a Hit Counter add hitCounterFunction = function () { XXX MY HIT COUNTER CODE }, this function will automatically be called each time someone click a page, so you can log per page hits within your frame.

The GoatCounter documentation is currently offline, so I cant provide a pre-made hitCounterFunction for you, but I'll add one in the future if the documentation ever comes back!

cinni:
i was super excited to try this out, till i got to the disclaimer... LOL


--- Quote from: Melooon on January 10, 2022 @936.08 ---NOTE: If you use one of those fancy iframe sites (like cinni.net) this guide will not work for you directly, but it can be easily adapted to suit your site too! Ask in the comments if you need help with that and Ill figure it out.

--- End quote ---

either way, i've been wanting to do something like this one day cuz that's the one thing i dont like about iframes :-O

Melooon:
This has been updated to support iFrames!

PurpleHello98:
Does anyone know how to make this work with div ids? I'd like to link to specific blog posts on my blog page and I give them all IDs based on the post title, like, for example "is-twilight-alright" for my most recent post. When I try to navigate to the individual blog HTML file outside of the frameset (like https://purplehello98.neocities.org/blog/frame#is-twilight-alright), the IDs work fine, but when I try to go to the post in the frameset (like https://purplehello98.neocities.org/main?z=/blog/frame#is-twilight-alright) it doesn't work. Does anyone know how to make it work short of just making every post its own page?

asterhalloween:
It took me a bit to figure out what I was doing but oh my goodness it works! I am making my site awesomer and awesomer by the second :evil: thank you!! :grin:

I swear, coding always finds new ways to feel magical. I love it!!

Navigation

[0] Message Index

[#] Next page

Go to full version