HTML File for the web viewer

hello every one
I work on HTML File for my app
i need to get value from URL ?
as example https://www.codeproject.com/5225378

how to get 5225378 from url and show it as text in the html ?

any one know how to do that in HTML File
THANK YOU

1 Like

Try this

Result is
image

1 Like

thank you muneer not that what i mean

i need Html code to do that to use it in the web viewer

1 Like

Can you explain more?

Do you want to change the number part of the URL to another number?

1 Like

look this for example my URL https://www.codeproject.com/5225378

how i can take the number after the slash 5225378 and displayed it as a Title in my HTML page

1 Like

When I click in the URL, I get this

1 Like

look muneer this code you write it for me 5 months ago
this code will take the url after the “showURL” word and displayed it in the iframe
what i need is the same but to displayed it as a text in the HTML page

sorry about my bad language i know it hard to you to understand me thank you

1 Like

Try this. If you use it in your browser and add any parameter to it you will see it in the HTML page

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Example for Bader</title>
</head>
<body>
  <h4>Text will show here</h4>
  <p id='exampleMsg'></p>
  <script>
    const partURL = new URLSearchParams(window.location.search);
    console.log(partURL);
    document.getElementById('exampleMsg').innerHTML = partURL;
  </script>
</body>
</html>

See this result
image

1 Like

thank you muneer that exactly what u need

but can i add something to this code just to show parameter after word “SHOW”

1 Like

Yes of course.

Change the line

document.getElementById('exampleMsg').innerHTML = partURL;

To the following

document.getElementById('exampleMsg').innerHTML = partURL.get('test');

Now you will see whatever you type in the URL after test=.

1 Like

it work THANK YOU for this fast solution :smiling_face_with_three_hearts:

1 Like

the last question please

is that possible to have tow (test) word in the url so i can get 2 value ?

like this - i try this put not work

1 Like

Yes, you can

1 Like

what i should to do
can you please tell me how ?

1 Like

See this code

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Example for Bader</title>
</head>
<body>
  <h4>Text will show here</h4>
  <p id='showMsg'></p>
  <script>
    const partURL = new URLSearchParams(window.location.search);
    let textToShow = '';
    if (partURL.has('test')){
      textToShow += partURL.get('test');
    }
    if (partURL.has('demo')){
      textToShow += '<br>' + partURL.get('demo');
    }
    if (textToShow.length > 0) {
      document.getElementById('showMsg').innerHTML = textToShow
    } else {
      document.getElementById('showMsg').innerHTML = 'no data';
    }
  </script>
</body>

Sample output

1 Like

Thank you munir but that not what I mean

I need each ID alone to use each word alone

Not to show the massage in one ID
THANK YOU

1 Like

Use this one then

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Example for Bader</title>
</head>
<body>
  <h4>Text will show here</h4>
  <p id='showMsg1'></p>
  <p id='showMsg2'></p>
  <script>
    const partURL = new URLSearchParams(window.location.search);
      document.getElementById('showMsg1').innerHTML = partURL.get('test');
      document.getElementById('showMsg2').innerHTML = partURL.get('demo');
  </script>
</body>
1 Like

Thank you so much muneer
Now it’s work 100% as I need :pray:

1 Like