Click here to Skip to main content
15,907,396 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want to create short for my project or browser that Which looks like an icon and in mobile phone and The user does not need to enter the address in url.the address bar be hidden

What I have tried:

i create google qrome shortcut in windows,but I do not know exactly how to hide the address bar
Posted
Updated 17-Nov-20 3:33am
Comments
Richard MacCutchan 17-Nov-20 6:20am    
The properties of a shortcut can always be viewed by the user.

Here are some console application routines for a Windows desktop shortcut.
Needs a reference to 'Windows Script Host Object Model', under References - COM.
Example usage:
CreateDesktopShortcut("MyWebApp", "https://localhost:443", true);

/// <summary>
/// Creates or deletes a desktop shortcut.
/// </summary>
/// <param name="appname">The appname.</param>
/// <param name="appPathFull">The full app Path or URL.</param>
/// <param name="create">True to create a shortcut or False to remove the shortcut.</param>
/// <returns>The .lnk full file name.</returns>
private static string CreateDesktopShortcut(string appname, string appPathFull, bool create)
{
    try
    {
        var desktopPathName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory), appname + ".lnk");
        CreateShortcut(desktopPathName, appPathFull, create);
        return desktopPathName;
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    }

    return string.Empty;
}

/// <summary>
/// Creates or removes a shortcut at the specified pathname.
/// Sets the icon of the shortcut to the exe icon.
/// </summary>
/// <param name="shortcutPathName">The path where the shortcut is to be created or removed from including the (.lnk) extension.</param>
/// <param name="shortcutTarget">The URL or exe to execute.</param>
/// <param name="create">True to create a shortcut or False to remove the shortcut.</param>
/// <param name="arguments">The optional arguments.</param>
private static void CreateShortcut(string shortcutPathName, string shortcutTarget, bool create, string arguments = "")
{
    if (create)
    {
        WshShell myShell = new WshShell();
        IWshShortcut myShortcut = myShell.CreateShortcut(shortcutPathName) as IWshShortcut;
        myShortcut.TargetPath = shortcutTarget;

        if (shortcutTarget.StartsWith("http"))
        {
            if (File.Exists("MyIcon.ico"))
            {
                myShortcut.IconLocation = "MyIcon.ico";
            }
        }
        else
        {
            // Not an URL, but an .exe or other file
            myShortcut.IconLocation = shortcutTarget + ",0";
            myShortcut.WorkingDirectory = Directory.GetParent(shortcutTarget).ToString();
        }

        myShortcut.Arguments = arguments;
        myShortcut.Save();
    }
    else
    {
        // Delete the shortcut
        if (File.Exists(shortcutPathName))
        {
            File.SetAttributes(shortcutPathName, FileAttributes.Normal);
            File.Delete(shortcutPathName);
        }
    }
}
 
Share this answer
 
v3
Sounds like you're looking for a Progressive Web App (PWA):
Progressive Web Apps - web.dev[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900