Displaying a simple HTML page from input embedded into a URL

hi,

I'm looking for a workaround to a problem that currently doesn't have a solution: to put multiple hyperlinks into a single cell of a spreadsheet (Excel or google sheets)

I suspect a 'fudge' workaround is possible as follows:

Spreadsheet to display a single hyperlink that contains a parameter listing a number of other urls
This link points to a special webpage to parse and display these links

eg spreadsheet displays "click to see list of products"
and webpage is "generated" showing the list of products with links

It's a bit of a fudge because the user will need to click a link twice (once on the spreadsheet, and then again on the webpage)

It maybe that a URL shortener service would also be required depending on the maximum permitted URL length

It's for low-volume use, I'm thinking to put such a webpage on my server for private use, so I'm looking for help to create this page.

Perhaps a more general version is to create a page that converts an input parameter into a new webpage. ie embedding some HTML as a parameter to then display this as a webpage.

Thanks
xeniumAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
I am not clear on what you are asking - maybe give us an example?

I am getting you want to either put multiple links into the cell of a spreadsheet - but as that is a simple process I am guessing that is not what you are asking.

Alternatively I am getting you want one link in the spreadsheet that opens a page with multiple links - but it is not clear as you are using words like "input" which bring some ambiguity to the question.
0
xeniumAuthor Commented:
hi Julian,

Thanks for your reply. Yes an example would probably help..

Suppose i want to put 2 links into a spreadsheet cell (I believe this is not possible, but correct me if wrong)

Instead I can put a single link to a webpage that contains the 2 links i want, for example to mypage.html containing the following HTML code:

<a href="https://www.google.co.uk/search?&q=apples">search apples</a>
<BR>
<a href="https://www.google.co.uk/search?&q=oranges">search oranges</a>


What I'd like is a way to create this page automatically, eg by feeding the above HTML code snippet as a parameter input to a webpage that simply displays the HTML

Thanks
0
Julian HansenCommented:
You mean like

http://www.yourdomain.com/makelinks/?links=apples,oranges,bananas

And the makelinks script takes the links GET parameter, splits it up and makes a page with three links each with a different q=<FRUITVALUE>

What would your server script need to be written in?
In Javascript you could do it like this
<ul id="links"></ul>

Open in new window

<script>
$(function() {
  if (window.location.search.indexOf('=') > -1) {
    var href = window.location.search.split('=')[1].split(',');
    var list = $('#links');
    for(var i = 0; i < href.length;i++) {
      var link = document.createElement('a');
      link.href = 'https://www.google.co.uk/search?q=' + href[i];
      link.target = '_blank';
      list.append($('<li>').append($(link).html(link.href)));
    }
  }
});
</script>

Open in new window

Your link would look something like this: http://www.yourdomain.com/page.html?link=apple,banana,orange

You can see it working http://www.marcorpsa.com/ee/t3003.html?links=apple,banana,orange
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Julian HansenCommented:
Note the ?links can be anything in this case - the important bit is the '?' followed by something followed by an '=' followed by a comma separated list of terms
0
xeniumAuthor Commented:
Thanks, that looks about right, i will try it later. btw the links could be completely different URLs, but i can see from your method that that's a trivial modification.
0
xeniumAuthor Commented:
That's great thanks. I need to adapt it to allow a complete URLs to be entered as parameters. The split terms (comma, equals) are interfering as they may appear in the URLs, how could i adapt the script?

Thanks again
0
xeniumAuthor Commented:
Changing the delimiters seems to work:

<script>
$(function() {
  if (window.location.search.indexOf('=') > -1) {
    var href = window.location.search.split('^')[1].split('@');
    var list = $('#links');
    for(var i = 0; i < href.length;i++) {
      var link = document.createElement('a');
      link.href = href[i];
      link.target = '_blank';
      list.append($('<li>', {class: 'list-group-item'}).append($(link).html(link.href)));
    }
  }
});
</script>

Open in new window


example:

mypage.html?links^https://www.google.co.uk/search?q=apple@https://www.google.co.uk/search?q=orange
0
xeniumAuthor Commented:
Can i use a delimiter longer than a character to make it more robust (in case a URL includes ^ or @ for example) ?
0
Julian HansenCommented:
It can but why not just use comma's as the delimiters - don't get overly complicated it will come back to byte (intentional misspelling) you

Remember we are not dealing with the URL - only with the search string - the bit that comes after the '?' so the URL can contain anything we don't care - but as long as you are consistent in the parameters you pass after the ? you are good to go.
0
xeniumAuthor Commented:
Because my URLs might contain commas, and they DO contain equals (=), so I needed to change the delimiter to enable the script to work.

A quick search reveals that a URL can also contain an @ symbol so maybe best avoid that.

What's the risk of using a delimiter that you wouldn't find in a URL?
0
xeniumAuthor Commented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Google

From novice to tech pro — start learning today.