Browser not allowing to add colon(:) at the end of a URL in windows.open()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 03:03 AM
The requirement is, when click on a widget button a url should be added to the new tab. url is in this format - eg. https://servicenow: or https://test:
This is a command that is being used by the user to open the application(named servicenow(can be anything)) in their local system.
The issue is that the browser is not allowing to add colon at the end of a url.
We understand that colon is a reserved character and has special purpose in url, so we tried using hex code for the same i.e 3A. But no positives either.
Is their some alternative way to add a colon at the end of a url?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 03:44 AM
Hi @Vipul Rajta1 ,
I trust you are doing great.
As you have rightly pointed out, the colon is a reserved character in a URL and it has a special meaning in identifying the protocol used in the URL (http:, https:, ftp: etc.). However, you can still add a colon at the end of a URL by using URL encoding.
URL encoding is a process of converting reserved characters into their corresponding hexadecimal code so that they can be safely transmitted over the internet. In your case, you can encode the colon character as %3A and append it at the end of your URL.
For example, if your original URL is https://servicenow, you can add a colon at the end and encode it as follows:
When the user clicks on the widget button, you can pass this encoded URL to the new tab to open the application. The browser will automatically decode the URL and display it correctly in the address bar.
I hope this solution works for your use case.
Please mark the answer correct if it was helpful.
Regards,
Amit Gujarathi
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 04:12 AM
Thanks for the reply, but we have tried this solution and no luck.
Browser is not allowing us to use %3A hex code. The link stops working, it doesn't even open a new tab. It is working with other hex code for other characters, but it is not working for colon.