The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
Posted
You may have to run the image path/name through a function that url encodes the text before inserting it into the JavaScript (assuming the JavaScript is generated by some ASP... can't get to the site from work.)
You could change the JavaScript to use double quotes around the value, but you would run into the same problem if there was a double quote in the path/name. Better to take the time now and work on a more complete solution.
You could change the JavaScript to use double quotes around the value, but you would run into the same problem if there was a double quote in the path/name. Better to take the time now and work on a more complete solution.
Posted
Yes, the script is called via ASP. I've tried replacing it with an escape-apostrophe, with a pair of them, and with an ascii value; none had any effect.
Posted
Are you doing a Server.URLEncode() on the image URL or are you just replacing ' with %27 ?
Posted
I've tried both. Neither works with the apostrophe issue. Server.URLEncode kills the script for all files.
Posted
Did you encode the whole bit of JavaScript or just the image url?
Posted
I encoded the path and image URL before sending to Javascript.
Posted
If you're setting an attribute with the image path perhaps you need to use server.htmlencode()
======
Doug G
======
Computer history and help at www.dougscode.com
Doug G
======
Computer history and help at www.dougscode.com
Posted
Server.HTMLEncode would be for displaying the URL on a page, it would render it useless as an actual link.
Posted
Another reply to an ancient topic. I solved this issue by replacing any apostrophe with the Unicode "Prime" character (looks just like an apostrophe) and Javascript is fine with it.
Email Member
Message Member
Post Moderation
FileUpload
If you're having problems uploading, try choosing a smaller image.
Preview post
Send Topic
Loading...