-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notify Users for the failure in loading Image via external URL #1813
Conversation
Working Clip - Screen.Recording.2021-02-16.at.8.05.58.PM.mov |
@jywarren , @harshkhandeparkar , @daemon1024 please have a look 😊 |
examples/lib/defaultHtmlStepUi.js
Outdated
@@ -57,7 +57,7 @@ function DefaultHtmlStepUi(_sequencer, options) { | |||
<div class="col-md-8 cal collapse in step-column">\ | |||
<div class="load load-spin" style="display:none;"><i class="fa fa-circle-o-notch fa-spin"></i></div>\ | |||
<div class="step-image">\ | |||
<a class="cal collapse in"><img class="img-thumbnail step-thumbnail"/></a>\ | |||
<a class="cal collapse in"><img class="img-thumbnail step-thumbnail" crossorigin="anonymous" /></a>\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this the only thing missing? It was working before but maybe browsers increased security requirements? Wow!
Do you think we can still run a test for this? We could pull in a remote image from a static source and use looks-same to compare it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sir i will try to run this one.
BTW i have one more approach to tackle this problem. We can create a local directory and once we place a url to load the image we can use that url to download the image in that directory and can render image directly from local folder this will remove the overhead of cross-origin.
What's your view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually previously this was the error in the console when image failed to load-
Uncaught Security Error: Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement’: tainted canvases may not be exported.
But after setting crossorigin=anonymous
this error disappeared.
That's great regarding the cross-origin error you caught. Thanks! I think
we'd best preserve this because people may want to begin with an image from
any other online source. The test will confirm that it is able to fetch it!
…On Tue, Feb 16, 2021 at 11:13 AM Vivek Singh ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In examples/lib/defaultHtmlStepUi.js
<#1813 (comment)>
:
> @@ -57,7 +57,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
<div class="col-md-8 cal collapse in step-column">\
<div class="load load-spin" style="display:none;"><i class="fa fa-circle-o-notch fa-spin"></i></div>\
<div class="step-image">\
- <a class="cal collapse in"><img class="img-thumbnail step-thumbnail"/></a>\
+ <a class="cal collapse in"><img class="img-thumbnail step-thumbnail" crossorigin="anonymous" /></a>\
Actually previously this was the error in the console when image failed to
load-
Uncaught Security Error: Failed to execute ‘toDataURL’ on
‘HTMLCanvasElement’: tainted canvases may not be
But after setting crossorigin=anonymous this error disappeared.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1813 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAF6J5SHRVOOAFZCKPSKIDS7KKQ5ANCNFSM4XWSQZTQ>
.
|
@jywarren i think the problem is still unresolved 😥 .while writing the test i tried one more time to import a image but it failed |
Possible solutions -
for handling of these requests. But sir if you have some other approach for this please let me know 😊 |
Ah, i see - well, for servers that have CORS permissions set, it's OK. But
is it possible to detect the CORS error and to report an error on the
screen for the user that links to a CORS explanation? I don't think we
should build in a proxy as part of our core code, but we could at least
inform the user of the limitations. How does that sound?
…On Wed, Feb 17, 2021 at 10:27 AM Vivek Singh ***@***.***> wrote:
Possible solutions -
1. use cors-anywhere
<https://github.com/Rob--W/cors-anywhere/#documentation> proxy
2. create our own proxy
for handling of these requests.
But sir if you have some other approach for this please let me know 😊
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1813 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAF6J7E3B2A52XBFYVJDSDS7PN5ZANCNFSM4XWSQZTQ>
.
|
sure sir, that sounds great!!! |
sounds great! And for the user message, you could consider using this:
https://getbootstrap.com/docs/4.4/components/toasts/
just an idea! Thank you!!
…On Wed, Feb 17, 2021 at 12:38 PM Vivek Singh ***@***.***> wrote:
sure sir, that sounds great!!!
I will find a way to accomplish this
|
That will look nice 😊 . |
That sounds right, yes!!!
…On Wed, Feb 17, 2021 at 12:51 PM Vivek Singh ***@***.***> wrote:
That will look nice 😊 .
BTW something similar can be done for #1310
<#1310> as well right?.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1813 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAF6J3UIQJFFOBP4JS6ZOTS7P6ZVANCNFSM4XWSQZTQ>
.
|
@jywarren finally after investing a decent amount of time on this i have completed this task successfully 😃 and tested it as well with both desktop and mobile view. |
examples/demo.css
Outdated
@@ -347,7 +347,18 @@ a.name-header{ | |||
left: 10%; | |||
top: 30px; | |||
} | |||
#update-prompt-modal.show { | |||
|
|||
#notify-box { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow cool, it looks like you created a custom alert box style, was there a reason why the bootstrap styles didn't work for you? Thanks!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no special reason for this .But the thing which took me to create a custom one is because toast is available in bootstrap version v4 and currently we have v3 so either we have to use cdn links or update it which i feel not to do so just for a notification prompt.
But it worth having this custom Toast. right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jywarren sir is it ok😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that makes sense! And, it looks nice, good work!
Let's do this: let's use a classname instead of an ID so it can be more easily reused, and let's also use the same classname as the Bootstrap 4 code -- that way if we upgrade in the future, it'll be a relatively easy change where we remove our custom style and switch over. How does that sound?
Thank you for your help on this!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds perfect!! . And sir you are right we should make this code a little bit more general in nature for further reusability. i will change it now 😊 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW i was just planning to provide you a visual for the changes i have made so that you can judge it better ,but before that you send this pick isn't it funny
@jywarren please have a look at these changes now |
@@ -358,7 +358,17 @@ a.name-header{ | |||
background:#c3c3c3; | |||
} | |||
|
|||
#update-prompt-modal.show,#notify-box { | |||
/* Bootstrap class for display none remove it after updating to version v4 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nicely done!
Nicely done and many thanks!!!! |
@jywarren Thank you so much sir |
Fixes #1808.
Now image can be rendered through URL as well.