Is there a way to remove first "/" from resources url?
See original GitHub issueI am trying to build an electron app. I am simply pointing electron api to the build folder. But the issue is I am getting the error failed to load file:///....
error. If I understand correctly, this is because of the extra slash at the beginning of the resource links.
I just want to change links in html and other files from "/static/js/main.2a85c832.js"
to "static/js/main.2a85c832.js"
?
Could anyone help? Thanks
Issue Analytics
- State:
- Created 7 years ago
- Reactions:8
- Comments:15 (6 by maintainers)
Top Results From Across the Web
How to remove the first slash in my URL with JavaScript
Different way. var rawurl = "/option=com_content&view=article&id=2&Itemid=2";. rawurl = rawurl.substr(rawurl.indexOf('/') + 1);.
Read more >How do I remove trailing slashes from a URL when using ...
You could always use mod_rewrite to redirect the directory name without the trailing slash to dirname/index.html . You could use RedirectConds to make...
Read more >URL Canonicalization and the Canonical Tag | Documentation
When a site has duplicate content, Google chooses the canonical URL. Learn more about canonical URLs and how to consolidate duplicate URLs.
Read more >Express Tutorial Part 4: Routes and controllers - MDN Web Docs
In this tutorial we'll set up routes (URL handling code) with "dummy" ... The first argument to this method is the URL path...
Read more >RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
The term "Uniform Resource Locator" (URL) refers to the subset of URIs that, ... A URI may be represented in a variety of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I know this is closed, but:
After coming back to this and using
react-router-dom
’sHashRouter
in addition to the"homepage" : "./"
trick, client side routing just works in my recent electron app. I’ve created this barebones electron-create-react-app boilerplate, just in case someone stumbles upon this and wants to have a look…So I’m also trying to use CRA with Cordova and I just messed around with this, and react-router can work if you use hashHistory rather than browserHistory. (I also implemented the homepage: ./ as well when I tested it).
*Unfortunately I need to use a login redirect which receives an access token, and they do not accept fragments (#) as the redirect url…
Although there may be other interesting solutions to this here: https://github.com/ReactTraining/react-router/issues/2161