https://github.com/mendixlabs/seturl
This widget sets a string as url for the current page.
https://github.com/mendixlabs/seturl
mendix-widget
Last synced: 4 months ago
JSON representation
This widget sets a string as url for the current page.
- Host: GitHub
- URL: https://github.com/mendixlabs/seturl
- Owner: mendixlabs
- Created: 2017-06-21T14:07:24.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-04T03:08:29.000Z (about 3 years ago)
- Last Synced: 2024-04-13T17:55:37.923Z (almost 2 years ago)
- Topics: mendix-widget
- Language: JavaScript
- Homepage: https://appstore.home.mendix.com/link/app/65083/
- Size: 513 KB
- Stars: 2
- Watchers: 8
- Forks: 2
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Set URL [](https://docs.mendix.com/community/app-store/app-store-content-support)
This widget will set a URL when loaded, enabling users to bookmark or refresh the page with F5, without being reset to the homepage.
This widget works best in combination with the [Deep Link Module](https://appstore.home.mendix.com/link/app/43/Mendix/Deep-link-module) to generate the actual URL's that will be set.
## Contributing
For more information on contributing to this repository visit [Contributing to a GitHub repository](https://world.mendix.com/display/howto50/Contributing+to+a+GitHub+repository)!
## Configuration
The URL is always set as a relative path from the root location.
So if you are on the App Store, you might use this configuration:
URL: "link/apps/${appid}/${creatorcompany}"
With the attributes set to the 'AppID' and the 'Appstore.App_Creator/Appstore.Creator/Name'.
From the root url "https://appstore.home.mendix.com/index3.html", the index3.html part is replaced with the configured path.
This would result in the url:
"https://appstore.home.mendix.com/link/app/65083/Mendix"
Both widgets set the URL when they are loaded and set it back to the application normal url once the user navigates away.
The 'Set URL' widget sets a static URL.
The 'Set URL Context' widget let's you use ${} variables that will be replaced by the associated attributes.
## Technical information
This widget uses the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to set the URL.
Using the history.replaceState() call, we can overwrite the normal 'index.html' URL that's usually in the URL-bar of your application and insert a different one that matches the content that is being shown. This doesn't affect the normal browser's Back and Forward buttons.