1 problem found
recently developed Excel import and export tools, greatly improving the work efficiency, complacent. However, when the project was deployed in a test environment, it was found that the file could not be uploaded in chrome, and the log reported the following error:
Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://xx.xx.xxx.xxx:8081 " from accessing a cross-origin frame.
at HTMLIFrameElement.<anonymous>http://xx.xx.xxx.xxx:8081/static-v1.0.0/dwz/js/dwz.ajax.js:76:20
at HTMLIFrameElement.dispatch http://xx.xx.xxx.xxx:8081/static-v1.0.0/dwz/js/jquery-2.1.4.min.js:3:6466 )
at HTMLIFrameElement.r.handle http://xx.xx.xxx.xxx:8081/static-v1.0.0/dwz/js/jquery-2.1.4.min.js:3:3241
h1> 2 analysis
The
read prompt is an exception that occurs when you fetch the iframe’s contentDocument. This exception is usually due to the browser’s same-domain readable and writeable policy, which is cross-domain readable but not writeable.
but we’re all in the same project and we’re all calling actions in the same field, so let’s put a breakpoint here and look at the actual iframe:
found this baseURI problem, the normal address should be the corresponding module URI, such as:
http://xxx/base/index#/xxx/table
, but the address here is the previous module URL (no use of Excel import and export tools), that is, the browser did not recognize the URL of the new page.
looks at the code and finds that in the generic freemarker page it says:
action="${contextPath}/${importUrl}"
and the URL passed in is:
"/xxx/importExcel"
combined address is:
//xxx/importExcel
did you notice that there was an extra /
in front of it, which caused the browser’s frame not to recognize this address!
3 address h1>
remove this extra /
, it’s ok to O(∩_∩)O~
Read More:
- Uncaught type error: cannot read property ‘MSIE’ of undefined
- Datatable plug-in error: uncaught typeerror: cannot read property ‘style’ of undefined
- Uncaught TypeError: Cannot read property ‘replace’ of null
- Remove video with video byte 0, uncaught (in promise) domexception: failed to load because no supported source was f
- Easywasmlayer reports an error uncaught (in promise) domexception when playing a video
- Uncaught typeerror: cannot set property ‘of null error resolution
- [TS] solutions to line 0: parsing error: cannot read property ‘map’ of undefined
- uncaught typeerror:cannt set property ‘0‘ of undefined
- Vue uses this. $refs. Subcomponent Ref. method to report an error: cannot read property ‘resetfields’ of undefined problem
- TypeError: Cannot read property ‘username‘ of undefined
- DOMException: play() failed because the user didn‘t interact with the document first
- Cannot read property ‘properties’ of undefined
- Vue: cannot read property ‘substring’ of undefined“
- Cannot read property ‘substring’ of undefined in Vue
- Cannot read property ‘i18n‘ of undefined
- TypeError: Cannot read property thisCompilation of undefined
- [Solved] Syntax Error: TypeError: Cannot read property ‘parseComponent‘ of undefined
- JS prompt cannot read property ‘style’ of undefined
- Cannot read property ‘catch‘ of undefined“
- Vue error resolution: TypeError: Cannot read property’_t’ of undefined”